diff options
-rw-r--r-- | build/database.js | 10 | ||||
-rw-r--r-- | src/database.ts | 16 |
2 files changed, 17 insertions, 9 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; } diff --git a/src/database.ts b/src/database.ts index 9bc7cda..0e16d48 100644 --- a/src/database.ts +++ b/src/database.ts @@ -532,8 +532,11 @@ async function getApplicableMemberLeaderboardAttributes(member: CleanMember): Pr const leaderboardsCountRequirement = await getLeaderboardRequirement('leaderboards_count', 'member') if ( - (leaderboardsCountRequirement.top_100 === null) - || (leaderboardsCount > leaderboardsCountRequirement.top_100) + leaderboardsCount > 0 + && ( + (leaderboardsCountRequirement.top_100 === null) + || (leaderboardsCount > leaderboardsCountRequirement.top_100) + ) ) applicableAttributes['leaderboards_count'] = leaderboardsCount @@ -542,10 +545,13 @@ async function getApplicableMemberLeaderboardAttributes(member: CleanMember): Pr const top1LeaderboardsCountRequirement = await getLeaderboardRequirement('top_1_leaderboards_count', 'member') if ( - (top1LeaderboardsCountRequirement.top_100 === null) - || (top1LeaderboardsCount > top1LeaderboardsCountRequirement.top_100) + top1LeaderboardsCount > 0 + && ( + (top1LeaderboardsCountRequirement.top_100 === null) + || (top1LeaderboardsCount > top1LeaderboardsCountRequirement.top_100) + ) ) - applicableAttributes['top_1_leaderboards_count'] = top1LeaderboardsCount + applicableAttributes['top_1_leaderboards_count'] = top1LeaderboardsCount return applicableAttributes } |