fix: use truthy check for intermission filter, add route test
`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:
@@ -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"],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user