From 10433f3837e471c2c3b985782dee5e10b8a98823 Mon Sep 17 00:00:00 2001 From: TrustyJAID Date: Fri, 4 Oct 2024 12:58:56 -0600 Subject: [PATCH] [Hockey] Fix some keyerrors in standings data --- hockey/hockeyset.py | 1 - hockey/standings.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hockey/hockeyset.py b/hockey/hockeyset.py index c0da7ddc04..1e165eac70 100644 --- a/hockey/hockeyset.py +++ b/hockey/hockeyset.py @@ -159,7 +159,6 @@ async def set_team_events(self, ctx: commands.Context, team: TeamFinder): edited = 0 async with ctx.typing(): for game in games: - start = game.game_start end = start + timedelta(hours=3) home = game.home_team diff --git a/hockey/standings.py b/hockey/standings.py index 27d2cf54cc..b934b39601 100644 --- a/hockey/standings.py +++ b/hockey/standings.py @@ -427,8 +427,8 @@ def from_nhle(cls, data: dict) -> TeamRecord: streak = Streak( **{ "streakType": "wins", - "streakNumber": data["streakCount"], - "streakCode": data["streakCode"], + "streakNumber": data.get("streakCount", 0), + "streakCode": data.get("streakCode", "N/A"), } ) return cls( @@ -456,7 +456,7 @@ def from_nhle(cls, data: dict) -> TeamRecord: row=0, games_played=int(data["gamesPlayed"]), streak=streak, - points_percentage=float(data["pointPctg"]), + points_percentage=float(data.get("pointPctg", 0.0)), pp_division_rank=0, pp_conference_rank=0, pp_league_rank=0,