From 09830e4e4b37ccf2be04d62e42f52da440ca6c51 Mon Sep 17 00:00:00 2001 From: User Name Date: Wed, 6 Mar 2024 20:16:55 -0500 Subject: [PATCH] fixed crash caused by missing "onIce" data --- src/data/data.py | 2 +- src/data/scoreboard.py | 4 +--- src/nhl_api/game.py | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/data/data.py b/src/data/data.py index a303917f..31f47623 100644 --- a/src/data/data.py +++ b/src/data/data.py @@ -212,7 +212,7 @@ def __parse_today(self): today -= timedelta(days=1) return today.year, today.month, today.day - #return 2021, 1, 26 + #return 2024, 3, 4 def date(self): return datetime(self.year, self.month, self.day).date() diff --git a/src/data/scoreboard.py b/src/data/scoreboard.py index 1e9c6b24..863cf14d 100755 --- a/src/data/scoreboard.py +++ b/src/data/scoreboard.py @@ -149,8 +149,6 @@ def __init__(self, overview, data): debug.error("Failed to get Goal details for current live game. will retry on data refresh") home_penalties = [] break - home_skaters = len(overview["homeTeam"]["onIce"]) - away_skaters = len(overview["awayTeam"]["onIce"]) home_pp = False away_pp = False @@ -254,7 +252,7 @@ def __init__(self, game_details, data): except KeyError: self.intermission = False - if game_details["gameState"] == "OFF" or game_details["gameState"] == "FINAL": + if game_details["gameState"] == "OFF" or game_details["gameState"] == "FINAL" or game_details["gameState"] == "OVER": if game_details["awayTeam"]["score"] > game_details["homeTeam"]["score"]: self.winning_team_id = game_details["awayTeam"]["id"] self.winning_score = game_details["awayTeam"]["score"] diff --git a/src/nhl_api/game.py b/src/nhl_api/game.py index fa1a03f8..25b2f99a 100644 --- a/src/nhl_api/game.py +++ b/src/nhl_api/game.py @@ -6,6 +6,7 @@ from nhl_api.utils import convert_time import nhl_api.object + from nhlpy import NHLClient # from nhl_api_client.api.play_by_play import get_schedule_by_date #from nhlpy.api.game_center import boxscore