fix: pin playoff card to its own gameNumber so the header doesn't tick forward after a final
CI / Lint (push) Successful in 10s
CI / Test (push) Successful in 10s
CI / Build & Push (push) Successful in 23s

series_state derives game_number from topSeedWins + bottomSeedWins + 1, which becomes the *next* game's number once the API advances seriesStatus post-final. The card for the just-finished game would then read "Game N+1 of 7". Prefer the raw gameNumber on the game payload, falling back to the derived value when it's missing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 18:41:04 -04:00
parent 13bb90b52b
commit e908139323
3 changed files with 22 additions and 3 deletions
+11 -2
View File
@@ -92,10 +92,19 @@ def series_state(series_status):
}
def _game_number(game, state):
"""This card's game number. Prefer the raw ``gameNumber`` field so we don't
drift forward once ``seriesStatus`` advances after the game ends."""
raw = game.get("gameNumber")
if isinstance(raw, int) and raw > 0:
return raw
return state["game_number"]
def series_blurb(game):
"""One sentence of series context for a playoff card."""
state = series_state(game.get("seriesStatus", {}))
g = state["game_number"]
g = _game_number(game, state)
leader_name = _leader_name(game, state)
trailer_name = _trailer_name(game, state)
@@ -137,7 +146,7 @@ def series_badges(game):
def series_summary(game):
"""Short line rendered above the card, e.g. 'Game 2 of 7'."""
state = series_state(game.get("seriesStatus", {}))
return f"Game {state['game_number']} of 7"
return f"Game {_game_number(game, state)} of 7"
def is_pinned(game):