Fix flex pick count using unique sports drafted, not total season sports

The flex count was calculated as `totalPicks - totalSportsInSeason`, which
always returned 0 when a team drafted multiple participants from the same
sport (e.g. 2 picks from UEFA Champions League with 2 sports in season =
2 - 2 = 0). Now uses the number of unique sports the team has actually
drafted from, so 2 picks in 1 sport correctly shows 1 flex used.

https://claude.ai/code/session_01DZ6jqgZTDEmJucanBtRCtM
This commit is contained in:
Claude 2026-02-21 05:17:32 +00:00
parent edc4eb75e8
commit ab03ebf9de
No known key found for this signature in database

View file

@ -85,12 +85,13 @@ export function TeamsDraftedGrid({
draftSlots.forEach((slot) => {
const teamPicks = picks.filter((p) => p.team.id === slot.team.id);
const flexUsed = Math.max(0, teamPicks.length - sports.length);
const uniqueSportsPicked = new Set(teamPicks.map((p) => p.sport.id)).size;
const flexUsed = Math.max(0, teamPicks.length - uniqueSportsPicked);
map.set(slot.team.id, flexUsed);
});
return map;
}, [picks, draftSlots, sports]);
}, [picks, draftSlots]);
if (sports.length === 0) {
return (