Skip to content

Commit 76eb88d

Browse files
authoredFeb 27, 2024··
Merge pull request #90 from qlemaire22:fix-bug-statistics
Player's statistics: remove faction fallback
2 parents 480fad8 + f4611b6 commit 76eb88d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/pages/players/[id]-[username]/statistics.astro

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const leaderboardEntries = player?.leaderboard_entries
4141
.sort((a, b) => (b.points ?? 0) - (a.points ?? 0))
4242
4343
const faction = new URLSearchParams(Astro.url.search).get("faction") || leaderboardEntries?.[0].race
44-
const leaderboard = leaderboardEntries.find((leaderboard) => leaderboard.race === faction) || leaderboardEntries?.[0]
44+
const leaderboard = leaderboardEntries.find((leaderboard) => leaderboard.race === faction) || null
4545
4646
let leaderboardHistory: LeaderboardEntryHistoryRow[] = []
4747
@@ -67,7 +67,7 @@ for (const entry of leaderboardHistory) {
6767
}
6868
6969
const today = new Date().toISOString().slice(0, 10)
70-
if (dateLabels[dateLabels.length - 1] !== today) {
70+
if (dateLabels[dateLabels.length - 1] !== today && leaderboard) {
7171
dateLabels.push(today)
7272
mmrEntries.push(Math.round(leaderboard.mmr))
7373
}

0 commit comments

Comments
 (0)
Please sign in to comment.