Syntrex commited on
Commit
6626cb0
·
verified ·
1 Parent(s): 4ca474f

Update visualization/game_cards.py

Browse files
Files changed (1) hide show
  1. visualization/game_cards.py +7 -6
visualization/game_cards.py CHANGED
@@ -92,12 +92,13 @@ def render_game_card(game: dict[str, Any]) -> None:
92
 
93
  competition_bucket = _safe_text(game.get("competition_bucket"), "OTHER").upper()
94
 
95
- if competition_bucket == "MLB":
96
- away_flag_url = get_team_logo_url(away_team)
97
- home_flag_url = get_team_logo_url(home_team)
98
- else:
99
- away_flag_url = get_team_flag_url(away_team)
100
- home_flag_url = get_team_flag_url(home_team)
 
101
 
102
  away_score = _safe_score(game.get("away_score"))
103
  home_score = _safe_score(game.get("home_score"))
 
92
 
93
  competition_bucket = _safe_text(game.get("competition_bucket"), "OTHER").upper()
94
 
95
+ # Be robust to missing / incorrect competition_bucket on some score rows:
96
+ # always try MLB logo lookup first, then fall back to country flag lookup.
97
+ away_logo_url = get_team_logo_url(away_team)
98
+ home_logo_url = get_team_logo_url(home_team)
99
+
100
+ away_flag_url = away_logo_url or get_team_flag_url(away_team)
101
+ home_flag_url = home_logo_url or get_team_flag_url(home_team)
102
 
103
  away_score = _safe_score(game.get("away_score"))
104
  home_score = _safe_score(game.get("home_score"))