fix: resolve 4 logic bugs found in code review
- utc_to_eastern: use zoneinfo instead of hardcoded EDT offset (-4) so start times are correct in both EST and EDT - standings: fetch before truncate so a failed API call doesn't wipe existing standings data - routes: call parse_games() once per request instead of three times - scheduler: wrap run_pending() in try/except so an unhandled exception doesn't kill the background thread Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,24 +25,12 @@ def get_scoreboard():
|
||||
)
|
||||
|
||||
if scoreboard_data:
|
||||
live_games = [
|
||||
game
|
||||
for game in parse_games(scoreboard_data)
|
||||
if game["Game State"] == "LIVE"
|
||||
]
|
||||
pre_games = [
|
||||
game for game in parse_games(scoreboard_data) if game["Game State"] == "PRE"
|
||||
]
|
||||
final_games = [
|
||||
game
|
||||
for game in parse_games(scoreboard_data)
|
||||
if game["Game State"] == "FINAL"
|
||||
]
|
||||
games = parse_games(scoreboard_data)
|
||||
return jsonify(
|
||||
{
|
||||
"live_games": live_games,
|
||||
"pre_games": pre_games,
|
||||
"final_games": final_games,
|
||||
"live_games": [g for g in games if g["Game State"] == "LIVE"],
|
||||
"pre_games": [g for g in games if g["Game State"] == "PRE"],
|
||||
"final_games": [g for g in games if g["Game State"] == "FINAL"],
|
||||
}
|
||||
)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user