aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-09 15:56:08 -0500
committermat <github@matdoes.dev>2022-04-09 15:56:17 -0500
commit5bcb606fd3133c4d2dd99302836dcf09da691e33 (patch)
treeab9dbb1bd34e6ea1b0101d701a535d013a64efa9
parent7dc93c14ffd1975c3961c381a6a9d84252eb4f03 (diff)
downloadskyblock-api-5bcb606fd3133c4d2dd99302836dcf09da691e33.tar.gz
skyblock-api-5bcb606fd3133c4d2dd99302836dcf09da691e33.tar.bz2
skyblock-api-5bcb606fd3133c4d2dd99302836dcf09da691e33.zip
Fix leaderboards
-rw-r--r--src/database.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/database.ts b/src/database.ts
index a3df3a2..4715ca9 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -701,9 +701,9 @@ export async function updateDatabaseMember(member: CleanMember, profile: CleanFu
const leaderboardAttributes = await getApplicableMemberLeaderboardAttributes(member)
- if (debug) console.debug('done getApplicableMemberLeaderboardAttributes..', leaderboardAttributes, member.username, profile.name)
+ if (debug) console.debug('done getApplicableMemberLeaderboardAttributes..', member.username, profile.name)
- if (leaderboardAttributes.length > 0) {
+ if (Object.values(leaderboardAttributes).length > 0) {
await memberLeaderboardsCollection.updateOne(
{
uuid: member.uuid,
@@ -742,7 +742,7 @@ export async function updateDatabaseMember(member: CleanMember, profile: CleanFu
cachedRawLeaderboards.set(attributeName, newRawLeaderboard)
}
- if (debug) console.debug('added member to leaderboards', member.username, leaderboardAttributes)
+ if (debug) console.debug('added member to leaderboards', leaderboardAttributes, member.username)
}
/**
@@ -862,8 +862,12 @@ async function removeBadMemberLeaderboardAttributes(): Promise<void> {
}
}
+ if (debug)
+ console.log('Deleted profiles that have no stats from leaderboards')
await memberLeaderboardsCollection.deleteMany({ stats: {} })
await profileLeaderboardsCollection.deleteMany({ stats: {} })
+ if (debug)
+ console.log('Finished deleted profiles that have no stats from leaderboards')
}
export let finishedCachingRawLeaderboards = false