From 779ec310feba9a1631015bee9085b8ffabd01b47 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Sun, 20 Jul 2025 17:41:28 -0500 Subject: [PATCH] mlb tester logic to filter correct games --- src/odds_ticker_manager.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/odds_ticker_manager.py b/src/odds_ticker_manager.py index b3d2d765..159aa922 100644 --- a/src/odds_ticker_manager.py +++ b/src/odds_ticker_manager.py @@ -185,9 +185,10 @@ class OddsTickerManager: for event in data.get('events', []): game_id = event['id'] status = event['status']['type']['name'].lower() + logger.debug(f"Event {game_id}: status={status}") - # Only include upcoming games - if status in ['scheduled', 'pre-game']: + # Only include upcoming games (handle both 'scheduled' and 'status_scheduled') + if status in ['scheduled', 'pre-game', 'status_scheduled']: game_time = datetime.fromisoformat(event['date'].replace('Z', '+00:00')) # Only include games in the next 7 days @@ -200,6 +201,8 @@ class OddsTickerManager: home_abbr = home_team['team']['abbreviation'] away_abbr = away_team['team']['abbreviation'] + logger.info(f"Found upcoming game: {away_abbr} @ {home_abbr} on {game_time}") + # Fetch odds for this game odds_data = self.odds_manager.get_odds( sport=sport, @@ -219,7 +222,11 @@ class OddsTickerManager: } games.append(game_data) - + else: + logger.debug(f"Game {game_id} is outside 7-day window: {game_time}") + else: + logger.debug(f"Game {game_id} has status '{status}', skipping") + except Exception as e: logger.error(f"Error fetching {league_config['league']} games for date {date}: {e}")