From f9d6321721946c0780cd33715bd61f5107b71d99 Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Tue, 31 Mar 2026 18:39:27 -0700 Subject: [PATCH] fix: use ELO change instead of win rate for best partner calculation --- src/app/players/[id]/profile/page.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/players/[id]/profile/page.tsx b/src/app/players/[id]/profile/page.tsx index 837b0f2..445760c 100644 --- a/src/app/players/[id]/profile/page.tsx +++ b/src/app/players/[id]/profile/page.tsx @@ -86,12 +86,14 @@ export default async function PlayerProfilePage({ params }: PageProps) { const totalWins = player.wins const winRate = totalGames > 0 ? ((totalWins / totalGames) * 100).toFixed(1) : "0.0" - // Get best partnership + // Get best partnership based on ELO contribution + // Best partner is the one who contributed most to your rating (highest totalEloChange) + // Must have played at least 2 games together to be considered const bestPartnership = partnershipStats.reduce((best, stat) => { - if (stat.gamesPlayed < 3) return best // Need at least 3 games for partnership to be meaningful - const currentRate = stat.wins / stat.gamesPlayed - const bestRate = best ? best.wins / best.gamesPlayed : 0 - return currentRate > bestRate ? stat : best + if (stat.gamesPlayed < 2) return best // Need at least 2 games for partnership to be meaningful + const currentEloChange = stat.totalEloChange + const bestEloChange = best ? best.totalEloChange : -Infinity + return currentEloChange > bestEloChange ? stat : best }, null as (typeof partnershipStats[0] | null)) return (