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:
parent
edc4eb75e8
commit
ab03ebf9de
1 changed files with 3 additions and 2 deletions
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue