aboutsummaryrefslogtreecommitdiff
path: root/src/database.ts
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-03-01 20:40:25 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-03-01 20:40:25 -0600
commitd2e9fcd259d918c74265eb608c6186aafe37222d (patch)
treec9ea98293327e7a002a3cdbbe60d7b4c1a985197 /src/database.ts
parentc8075c866580909cf7a297655b4361a60b1187dc (diff)
downloadskyblock-api-d2e9fcd259d918c74265eb608c6186aafe37222d.tar.gz
skyblock-api-d2e9fcd259d918c74265eb608c6186aafe37222d.tar.bz2
skyblock-api-d2e9fcd259d918c74265eb608c6186aafe37222d.zip
fix leaderboards being purged for reverse leaderboards
Diffstat (limited to 'src/database.ts')
-rw-r--r--src/database.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database.ts b/src/database.ts
index a4e401a..0ed8c7c 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -293,9 +293,11 @@ async function removeBadMemberLeaderboardAttributes() {
unsetValue[leaderboard] = ''
const filter = {}
const requirement = await getMemberLeaderboardRequirement(leaderboard)
+ const leaderboardReversed = isLeaderboardReversed(leaderboard)
if (requirement !== null) {
filter[`stats.${leaderboard}`] = {
- '$lt': requirement
+ '$lt': leaderboardReversed ? undefined : requirement,
+ '$gt': leaderboardReversed ? requirement : undefined
}
await memberLeaderboardsCollection.updateMany(
filter,