aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-03-01 20:42:40 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-03-01 20:42:40 -0600
commit36167af958d472b936d5c575662ef37cbd6f8448 (patch)
tree6186ed577c182636210149922a93cfaf539a53d7 /build
parent7a486de4e902faa3bad201e83434e008cb3714b7 (diff)
downloadskyblock-api-36167af958d472b936d5c575662ef37cbd6f8448.tar.gz
skyblock-api-36167af958d472b936d5c575662ef37cbd6f8448.tar.bz2
skyblock-api-36167af958d472b936d5c575662ef37cbd6f8448.zip
fix members not being added to reverse leaderboards
Diffstat (limited to 'build')
-rw-r--r--build/database.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/build/database.js b/build/database.js
index 08bbb22..c3f2518 100644
--- a/build/database.js
+++ b/build/database.js
@@ -194,10 +194,11 @@ async function getMemberLeaderboardRequirement(name) {
async function getApplicableAttributes(member) {
const leaderboardAttributes = getMemberLeaderboardAttributes(member);
const applicableAttributes = {};
- for (const [attributeName, attributeValue] of Object.entries(leaderboardAttributes)) {
- const requirement = await getMemberLeaderboardRequirement(attributeName);
- if (!requirement || attributeValue > requirement)
- applicableAttributes[attributeName] = attributeValue;
+ for (const [leaderboard, attributeValue] of Object.entries(leaderboardAttributes)) {
+ const requirement = await getMemberLeaderboardRequirement(leaderboard);
+ const leaderboardReversed = isLeaderboardReversed(leaderboard);
+ if (!requirement || leaderboardReversed ? attributeValue < requirement : attributeValue > requirement)
+ applicableAttributes[leaderboard] = attributeValue;
}
return applicableAttributes;
}