diff options
author | mat <github@matdoes.dev> | 2022-04-01 02:11:22 +0000 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-01 02:11:22 +0000 |
commit | f87e2c16275fd0940d0ab12c97cac6784cbd9d40 (patch) | |
tree | 5e03fb9401dbe8549b1c5cfaed93154b9a4a59c3 /src/database.ts | |
parent | 43905eeee7336da2e474c578330a73617d31314a (diff) | |
download | skyblock-api-f87e2c16275fd0940d0ab12c97cac6784cbd9d40.tar.gz skyblock-api-f87e2c16275fd0940d0ab12c97cac6784cbd9d40.tar.bz2 skyblock-api-f87e2c16275fd0940d0ab12c97cac6784cbd9d40.zip |
sort leaderboards in profile
Diffstat (limited to 'src/database.ts')
-rw-r--r-- | src/database.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/database.ts b/src/database.ts index 1f4c89a..7371fbf 100644 --- a/src/database.ts +++ b/src/database.ts @@ -441,6 +441,12 @@ export async function fetchMemberLeaderboard(name: string): Promise<MemberLeader const fetchLeaderboardPlayer = async (i: memberRawLeaderboardItem): Promise<MemberLeaderboardItem> => { const player = await cached.fetchBasicPlayer(i.uuid) + + if (player) { + // we don't need this in leaderboards + delete player.claimed + } + return { player, profileUuid: i.profile, @@ -538,6 +544,8 @@ export async function fetchMemberLeaderboardSpots(player: string, profile: strin }) } + memberLeaderboardSpots.sort((a, b) => a.positionIndex - b.positionIndex) + return memberLeaderboardSpots } @@ -808,7 +816,6 @@ async function removeBadMemberLeaderboardAttributes(): Promise<void> { await memberLeaderboardsCollection.deleteMany({ stats: {} }) await profileLeaderboardsCollection.deleteMany({ stats: {} }) - } export let finishedCachingRawLeaderboards = false |