From 6f51ad8c7874687773c75dae2b3853727a305dd4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 20:38:23 +0000 Subject: [PATCH] Don't show Game #1 label for single-game matchups in calendar When a matchup has only one game, showing "Game #1" is redundant and unhelpful. Only show game numbers when there are multiple games in a matchup (gameKeys.size > 1). For single-game matchups, show just the round name (or null if it matches the event name). Closes #198 https://claude.ai/code/session_01CRrqu43FKHshpJt1NyrDdX --- app/models/__tests__/upcoming-calendar.test.ts | 10 +++++----- app/models/scoring-event.ts | 14 ++++---------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/app/models/__tests__/upcoming-calendar.test.ts b/app/models/__tests__/upcoming-calendar.test.ts index e55a330..81ee73f 100644 --- a/app/models/__tests__/upcoming-calendar.test.ts +++ b/app/models/__tests__/upcoming-calendar.test.ts @@ -350,7 +350,7 @@ describe("getUpcomingEventsForDraftedParticipants — bracket sports", () => { expect(result[0].earliestGameTime).toBe(gameTime1.toISOString()); }); - it("sets matchLabel to round+game when single game key (non-redundant)", async () => { + it("sets matchLabel to round name only (no game number) for single-game matchup", async () => { const rows = [{ id: "e1", name: "PDC World Championship", eventDate: "2025-04-09", eventType: "playoff_game", sportsSeasonId: SPORTS_SEASON_ID, @@ -365,12 +365,12 @@ describe("getUpcomingEventsForDraftedParticipants — bracket sports", () => { DATE_FROM, DATE_TO ); - expect(result[0].matchLabel).toBe("Semifinals Game #1"); + expect(result[0].matchLabel).toBe("Semifinals"); }); - it("omits redundant round prefix when round name matches event name", async () => { + it("sets matchLabel to null when round name matches event name (single game)", async () => { // e.g. event named "Knockout Stage", round also "Knockout Stage", single game - // → show "Game #1" rather than the redundant "Knockout Stage Game #1" + // → show null rather than redundant label const rows = [{ id: "e1", name: "Knockout Stage", eventDate: null, eventType: "playoff_game", sportsSeasonId: SPORTS_SEASON_ID, @@ -385,7 +385,7 @@ describe("getUpcomingEventsForDraftedParticipants — bracket sports", () => { DATE_FROM, DATE_TO ); - expect(result[0].matchLabel).toBe("Game #1"); + expect(result[0].matchLabel).toBeNull(); }); it("all-compete events have null earliestGameTime and matchLabel", async () => { diff --git a/app/models/scoring-event.ts b/app/models/scoring-event.ts index 28478ee..18470f5 100644 --- a/app/models/scoring-event.ts +++ b/app/models/scoring-event.ts @@ -528,16 +528,10 @@ export async function getUpcomingEventsForDraftedParticipants( // Build matchLabel from game keys const gameKeys = gameKeysByEvent.get(eventId) ?? new Set(); - if (gameKeys.size === 1) { - const [round, gameNumberStr] = [...gameKeys][0].split("|"); - // When round name duplicates the event name, omit the round to avoid - // "Knockout Stage — Knockout Stage Game #1"; just show "Game #1" instead. - event.matchLabel = - round === event.name - ? `Game #${gameNumberStr}` - : `${round} Game #${gameNumberStr}`; - } else if (gameKeys.size > 1) { - // Multiple games — use just the round if it differs from the event name + if (gameKeys.size >= 1) { + // Only show the round name, not game numbers. Game numbers are only + // relevant when there are multiple games in a matchup (e.g. Game #2), + // but "Game #1" is redundant when there's only one game. const rounds = new Set([...gameKeys].map((k) => k.split("|")[0])); if (rounds.size === 1) { const round = [...rounds][0];