Fix draft round showing Infinity before draft starts (#9)
When draftSlots is empty (pre-draft state), dividing by zero caused Math.ceil to return Infinity. Guard the division to fall back to round 1. https://claude.ai/code/session_017mLmGc5wTrESaDeRQHkSPy Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
47b69ce9cf
commit
83994b7a74
2 changed files with 2 additions and 2 deletions
|
|
@ -150,7 +150,7 @@ export default function DraftBoard() {
|
|||
{season.league.name} - {season.year} Draft Board
|
||||
</h1>
|
||||
<div className="flex gap-4 text-sm text-muted-foreground mt-1">
|
||||
<span>Round: {Math.ceil(currentPick / totalTeams)}</span>
|
||||
<span>Round: {totalTeams > 0 ? Math.ceil(currentPick / totalTeams) : 1}</span>
|
||||
<span>Pick: {currentPick}</span>
|
||||
<span className="capitalize">
|
||||
{season.status.replace("_", " ")}
|
||||
|
|
|
|||
|
|
@ -654,7 +654,7 @@ export default function DraftRoom() {
|
|||
};
|
||||
|
||||
// Calculate current round
|
||||
const currentRound = Math.ceil(currentPick / draftSlots.length);
|
||||
const currentRound = draftSlots.length > 0 ? Math.ceil(currentPick / draftSlots.length) : 1;
|
||||
|
||||
// Determine whose turn it is
|
||||
const totalTeams = draftSlots.length;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue