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 (