Fix flex spot count in draft room Teams Drafted view
The flexSpots column in the database defaults to 0 and was never populated, causing the Teams Drafted grid to always show "0 of 0 flex". Calculate numFlexPicks dynamically in the loader as max(0, draftRounds - seasonSports.length) so teams see the correct flex count (e.g. 7 rounds - 5 sports = 2 flex). https://claude.ai/code/session_01CSzF4aWuyppGBDqM4MJmhc
This commit is contained in:
parent
9ae00a8385
commit
3496289da1
1 changed files with 3 additions and 1 deletions
|
|
@ -184,6 +184,7 @@ export async function loader(args: any) {
|
|||
userAutodraftSettings,
|
||||
isCommissioner: !!isCommissioner,
|
||||
currentUserId: userId,
|
||||
numFlexPicks: Math.max(0, season.draftRounds - seasonSports.length),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -200,6 +201,7 @@ export default function DraftRoom() {
|
|||
userAutodraftSettings,
|
||||
isCommissioner,
|
||||
currentUserId,
|
||||
numFlexPicks,
|
||||
} = useLoaderData<typeof loader>();
|
||||
const { isConnected, connectionError, isReconnecting, on, off } = useDraftSocket(season.id, userTeam?.id);
|
||||
const {
|
||||
|
|
@ -999,7 +1001,7 @@ export default function DraftRoom() {
|
|||
id: season.id,
|
||||
name: `${season.year} Season`,
|
||||
year: season.year,
|
||||
numFlexPicks: season.flexSpots,
|
||||
numFlexPicks: numFlexPicks,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue