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:
Chris Parsons 2026-02-20 11:16:34 -08:00 committed by GitHub
parent 47b69ce9cf
commit 83994b7a74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -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("_", " ")}

View file

@ -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;