From 98cd3d8843efe1d4864174806003821e8c69e8a5 Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Sun, 27 Apr 2025 15:34:28 -0500 Subject: [PATCH] Fix scope of is_favorite_game variable in MLB API data fetching --- src/mlb_manager.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mlb_manager.py b/src/mlb_manager.py index b36af499..a1e111c9 100644 --- a/src/mlb_manager.py +++ b/src/mlb_manager.py @@ -278,13 +278,6 @@ class BaseMLBManager: status = event['status']['type']['name'].lower() status_state = event['status']['type']['state'].lower() - # Add detailed logging for status information - if is_favorite_game: - self.logger.debug(f"[MLB] Full status data: {event['status']}") - self.logger.debug(f"[MLB] Status type: {status}, State: {status_state}") - self.logger.debug(f"[MLB] Status detail: {event['status'].get('detail', '')}") - self.logger.debug(f"[MLB] Status shortDetail: {event['status'].get('shortDetail', '')}") - # Get team information competitors = event['competitions'][0]['competitors'] home_team = next(c for c in competitors if c['homeAway'] == 'home') @@ -294,10 +287,16 @@ class BaseMLBManager: home_abbr = home_team['team']['abbreviation'] away_abbr = away_team['team']['abbreviation'] - # Only log detailed information for favorite teams + # Check if this is a favorite team game is_favorite_game = (home_abbr in self.favorite_teams or away_abbr in self.favorite_teams) + + # Only log detailed information for favorite teams if is_favorite_game: self.logger.info(f"Found favorite team game: {away_abbr} @ {home_abbr} (Status: {status}, State: {status_state})") + self.logger.debug(f"[MLB] Full status data: {event['status']}") + self.logger.debug(f"[MLB] Status type: {status}, State: {status_state}") + self.logger.debug(f"[MLB] Status detail: {event['status'].get('detail', '')}") + self.logger.debug(f"[MLB] Status shortDetail: {event['status'].get('shortDetail', '')}") # Get game state information if status_state == 'in':