mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-02 08:07:40 -05:00
Fix leaderboards crash
This commit is contained in:
@@ -24,8 +24,8 @@ export function addTiers(entries: UserSPLeaderboardItem[]) {
|
||||
});
|
||||
}
|
||||
|
||||
export function addWeapons(
|
||||
entries: ReturnType<typeof addTiers>,
|
||||
export function addWeapons<T extends { id: number }>(
|
||||
entries: T[],
|
||||
weapons: SeasonPopularUsersWeapon
|
||||
) {
|
||||
return entries.map((entry) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
type RankedModeShort,
|
||||
} from "~/modules/in-game-lists";
|
||||
import { rankedModesShort } from "~/modules/in-game-lists/modes";
|
||||
import { allSeasons } from "~/features/mmr/season";
|
||||
import { allSeasons, currentSeason } from "~/features/mmr/season";
|
||||
import {
|
||||
addPlacementRank,
|
||||
addTiers,
|
||||
@@ -103,7 +103,10 @@ export const loader = async ({ request }: LoaderArgs) => {
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
async getFreshValue() {
|
||||
const leaderboard = userSPLeaderboard(0);
|
||||
const withTiers = addTiers(leaderboard);
|
||||
// TODO: handle viewing during off-season
|
||||
const withTiers = currentSeason(new Date())
|
||||
? addTiers(leaderboard)
|
||||
: leaderboard.map((e) => ({ ...e, tier: undefined }));
|
||||
|
||||
return addWeapons(withTiers, seasonPopularUsersWeapon(0));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user