Show game number when multiple games from same series are in date window

The gameKeys.size > 1 branch previously showed only the round name,
contradicting the rule that multi-game series always show "Game #x".
Now shows the lowest game number visible in the window (e.g. both
Game #1 and #2 upcoming → "Semifinals Game #1").

https://claude.ai/code/session_01CRrqu43FKHshpJt1NyrDdX
This commit is contained in:
Claude 2026-03-22 21:18:32 +00:00
parent a4c5e7b4d5
commit 7001ec1227
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View file

@ -362,6 +362,8 @@ describe("getUpcomingEventsForDraftedParticipants — bracket sports", () => {
// Should use the earlier time
expect(result[0].earliestGameTime).toBe(gameTime1.toISOString());
// Both games in the window → multi-game series → show lowest game number
expect(result[0].matchLabel).toBe("Knockout Stage Game #1");
});
it("sets matchLabel to round name only (no game number) for single-game matchup", async () => {

View file

@ -578,11 +578,13 @@ export async function getUpcomingEventsForDraftedParticipants(
}
}
} else if (gameKeys.size > 1) {
// Multiple games across the matchup — use just the round name.
// Multiple games in the window — it's a series, show the lowest game number.
const rounds = new Set([...gameKeys].map((k) => k.split("|")[0]));
if (rounds.size === 1) {
const round = [...rounds][0];
event.matchLabel = round === event.name ? null : round;
const minGameNumber = Math.min(...[...gameKeys].map((k) => parseInt(k.split("|")[1], 10)));
event.matchLabel =
round === event.name ? `Game #${minGameNumber}` : `${round} Game #${minGameNumber}`;
}
}
}