From 5bcb606fd3133c4d2dd99302836dcf09da691e33 Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 9 Apr 2022 15:56:08 -0500 Subject: Fix leaderboards --- src/database.ts | 10 +++++++--- 1 file 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 { } } + 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 -- cgit