From 21219917f4007626bc4ee900ef732952f78e1706 Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Sun, 27 Apr 2025 15:00:01 -0500 Subject: [PATCH] Fix NHL upcoming games time window calculation - now properly checks for games within next 48 hours instead of past 48 hours --- src/nhl_managers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nhl_managers.py b/src/nhl_managers.py index ee6650ee..1423f1ba 100644 --- a/src/nhl_managers.py +++ b/src/nhl_managers.py @@ -351,8 +351,14 @@ class BaseNHLManager: # Calculate if game is within recent window is_within_window = False if start_time_utc: - cutoff_time = datetime.now(timezone.utc) - timedelta(hours=self.recent_hours) - is_within_window = start_time_utc > cutoff_time + # For upcoming games, check if the game is within the next 48 hours + if status["type"]["state"] == "pre": + cutoff_time = datetime.now(timezone.utc) + timedelta(hours=self.recent_hours) + is_within_window = start_time_utc <= cutoff_time + else: + # For recent games, check if the game is within the last 48 hours + cutoff_time = datetime.now(timezone.utc) - timedelta(hours=self.recent_hours) + is_within_window = start_time_utc > cutoff_time self.logger.debug(f"[NHL] Game time: {start_time_utc}, Cutoff time: {cutoff_time}, Within window: {is_within_window}") details = {