fix: use ELO change instead of win rate for best partner calculation

This commit is contained in:
2026-03-31 18:39:27 -07:00
parent b38b88f67d
commit f9d6321721
+7 -5
View File
@@ -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 (