aboutsummaryrefslogtreecommitdiff
path: root/build/database.js
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-08-06 01:52:44 -0500
committermat <github@matdoes.dev>2021-08-06 01:52:44 -0500
commit940433a9eed72796072e2ad448ba5f236c55de10 (patch)
treed0abd9cf4f1cac8f0f1f21b28d7e21e528bc34c7 /build/database.js
parentf328daa61e27e75e9a0e77947fb2b9b37ec421e8 (diff)
downloadskyblock-api-940433a9eed72796072e2ad448ba5f236c55de10.tar.gz
skyblock-api-940433a9eed72796072e2ad448ba5f236c55de10.tar.bz2
skyblock-api-940433a9eed72796072e2ad448ba5f236c55de10.zip
don't add players to leaderboards leaderboards when they aren't on any
Diffstat (limited to 'build/database.js')
-rw-r--r--build/database.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/build/database.js b/build/database.js
index 8543901..a12fc9e 100644
--- a/build/database.js
+++ b/build/database.js
@@ -403,14 +403,16 @@ async function getApplicableMemberLeaderboardAttributes(member) {
// add the "leaderboards count" attribute
const leaderboardsCount = Object.keys(applicableAttributes).length;
const leaderboardsCountRequirement = await getLeaderboardRequirement('leaderboards_count', 'member');
- if ((leaderboardsCountRequirement.top_100 === null)
- || (leaderboardsCount > leaderboardsCountRequirement.top_100))
+ if (leaderboardsCount > 0
+ && ((leaderboardsCountRequirement.top_100 === null)
+ || (leaderboardsCount > leaderboardsCountRequirement.top_100)))
applicableAttributes['leaderboards_count'] = leaderboardsCount;
// add the "first leaderboards count" attribute
const top1LeaderboardsCount = Object.keys(applicableTop1Attributes).length;
const top1LeaderboardsCountRequirement = await getLeaderboardRequirement('top_1_leaderboards_count', 'member');
- if ((top1LeaderboardsCountRequirement.top_100 === null)
- || (top1LeaderboardsCount > top1LeaderboardsCountRequirement.top_100))
+ if (top1LeaderboardsCount > 0
+ && ((top1LeaderboardsCountRequirement.top_100 === null)
+ || (top1LeaderboardsCount > top1LeaderboardsCountRequirement.top_100)))
applicableAttributes['top_1_leaderboards_count'] = top1LeaderboardsCount;
return applicableAttributes;
}