diff --git a/src/routes/player/[id]/+page.svelte b/src/routes/player/[id]/+page.svelte
index d5eea54..169f12b 100644
--- a/src/routes/player/[id]/+page.svelte
+++ b/src/routes/player/[id]/+page.svelte
@@ -66,6 +66,12 @@
const hsPercent =
totalHeadshots > 0 && totalKills > 0 ? ((totalHeadshots / totalKills) * 100).toFixed(1) : '0.0';
+ // Calculate win/loss/tie statistics from playerStats
+ const wins = playerStats.filter((stat) => stat.won).length;
+ const ties = playerStats.filter((stat) => stat.tied).length;
+ const totalMatchesWithStats = playerStats.length;
+ const losses = totalMatchesWithStats - wins - ties;
+
// Check if player is favorited
const isFavorite = $derived($preferences.favoritePlayers.includes(profile.id));
@@ -320,7 +326,7 @@
Career Statistics
-
+
@@ -343,6 +349,23 @@
+
+
+
+ Match Record
+
+
+ {wins}W
+ /
+ {losses}L
+ /
+ {ties}T
+
+
+ Last {totalMatchesWithStats} matches
+
+
+
diff --git a/src/routes/player/[id]/+page.ts b/src/routes/player/[id]/+page.ts
index 3cc73be..8332c2a 100644
--- a/src/routes/player/[id]/+page.ts
+++ b/src/routes/player/[id]/+page.ts
@@ -30,15 +30,20 @@ export const load: PageLoad = async ({ params }) => {
const playerData = match.players?.find((p) => p.id === playerId);
if (!playerData) return null;
+ const isTie = match.score_team_a === match.score_team_b;
+ const won =
+ !isTie &&
+ ((playerData.team_id === 2 && match.score_team_a > match.score_team_b) ||
+ (playerData.team_id === 3 && match.score_team_b > match.score_team_a));
+
return {
match_id: match.match_id,
map: match.map,
date: match.date,
...playerData,
- // Add match result (did player win?)
- won:
- (playerData.team_id === 2 && match.score_team_a > match.score_team_b) ||
- (playerData.team_id === 3 && match.score_team_b > match.score_team_a)
+ // Add match results
+ won,
+ tied: isTie
};
})
.filter((stat): stat is NonNullable => stat !== null);