Skip to content

Commit

Permalink
fix(front): Fixed sorting when grouping leaderboards
Browse files Browse the repository at this point in the history
  • Loading branch information
GordiNoki authored and tsa96 committed Jan 10, 2025
1 parent c21bbc9 commit 8c1d355
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/frontend/src/app/util/grouped-map-leaderboards.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ export function groupMapLeaderboards(
// Then if all lbs hidden
// Then try > number bonuses
arr.sort((a: GroupedMapLeaderboard, b: GroupedMapLeaderboard) => {
if (a.tier != null && b.tier == null) return 1;
if (a.type > b.type) return 1;
if (!a.allHidden && b.allHidden) return 1;
if (a.bonuses?.length ?? 0 > b.bonuses?.length ?? 0) return 1;
if (a.tier !== b.tier) return a.tier === null ? 1 : -1;
if (a.type !== b.type) return a.type - b.type;
if (a.allHidden !== b.allHidden) return a.allHidden ? 1 : -1;
if (a.bonuses?.length !== b.bonuses?.length)
return (a.bonuses?.length ?? 0) - (b.bonuses?.length ?? 0);
return 0;
});

Expand Down

0 comments on commit 8c1d355

Please sign in to comment.