fix: drop game_number by one for finished playoff cards
Scoreboard payloads don't include gameNumber, so the previous fix fell straight through to series_state['game_number'], which is hi+lo+1 — the *next* game. Once a game goes FINAL the win for this game is already banked in seriesStatus, so the card's own number is hi+lo. For the just-played Game 1 of Kings/Avalanche (series now 1-0), this brings the header back to "Game 1 of 7" instead of "Game 2 of 7". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -149,10 +149,17 @@ class TestSeriesSummary:
|
||||
game = make_playoff_game(top_wins=1, bottom_wins=1)
|
||||
assert series_summary(game) == "Game 3 of 7"
|
||||
|
||||
def test_finished_game_keeps_its_own_number(self):
|
||||
# seriesStatus has advanced to 2-0 after this game finished, but the
|
||||
# raw gameNumber pins the card to the game it actually represents.
|
||||
game = make_playoff_game(top_wins=2, bottom_wins=0, game_number=2)
|
||||
def test_finished_game_uses_pre_advance_number(self):
|
||||
# Scoreboard payloads don't carry gameNumber. Once a game goes FINAL,
|
||||
# seriesStatus already includes this game's result, so the card's game
|
||||
# number is hi+lo, not hi+lo+1.
|
||||
game = make_playoff_game(top_wins=1, bottom_wins=0, game_state="FINAL")
|
||||
assert series_summary(game) == "Game 1 of 7"
|
||||
|
||||
def test_finished_game_honors_explicit_game_number(self):
|
||||
game = make_playoff_game(
|
||||
top_wins=2, bottom_wins=0, game_state="FINAL", game_number=2
|
||||
)
|
||||
assert series_summary(game) == "Game 2 of 7"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user