fix: use truthy check for intermission filter, add route test
All checks were successful
CI / Lint (push) Successful in 7s
CI / Test (push) Successful in 6s
CI / Build & Push (push) Successful in 19s

`is True` strict identity fails if the NHL API returns an integer 1
instead of a JSON boolean. A truthy check is safe here since the
Intermission field is always False/0 for non-intermission live games.

Also adds a test that verifies intermission games are separated from
live games in the /scoreboard response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-29 19:57:00 -04:00
parent f652743333
commit 6c098850f5
2 changed files with 32 additions and 1 deletions

View File

@@ -48,7 +48,14 @@ def get_scoreboard():
games = parse_games(scoreboard_data)
return jsonify(
{
"live_games": [g for g in games if g["Game State"] == "LIVE"],
"live_games": [
g
for g in games
if g["Game State"] == "LIVE" and not g["Intermission"]
],
"intermission_games": [
g for g in games if g["Game State"] == "LIVE" and g["Intermission"]
],
"pre_games": [g for g in games if g["Game State"] == "PRE"],
"final_games": [g for g in games if g["Game State"] == "FINAL"],
}