From 58ab455a404291fdcb0a407374a1d83517daabf3 Mon Sep 17 00:00:00 2001 From: TrustyJAID Date: Fri, 21 Jun 2024 21:04:38 -0600 Subject: [PATCH] [Hockey] Fix an issue with playoffs lookup now missing keys --- hockey/constants.py | 2 +- hockey/game.py | 10 ++++++++-- hockey/standings.py | 5 +++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hockey/constants.py b/hockey/constants.py index d8b2474d37..cd247c79ff 100644 --- a/hockey/constants.py +++ b/hockey/constants.py @@ -310,7 +310,7 @@ "emoji": "OttawaSenators:897522793254625391", "home": "#E31837", "id": 9, - "invite": "https://discord.gg/senscord", + "invite": "https://discord.gg/xPkughF2xr", "logo": "https://i.imgur.com/HGvOFDf.png", "team_url": "https://www.nhl.com/senators", "timezone": "US/Eastern", diff --git a/hockey/game.py b/hockey/game.py index 781001d5c6..2ebcf98dce 100644 --- a/hockey/game.py +++ b/hockey/game.py @@ -417,7 +417,10 @@ async def make_game_embed( em.add_field(name=home_field, value=home_str) em.add_field(name=away_field, value=away_str) if self.game_type is GameType.playoffs and not self.game_state.is_preview(): - playoffs = await self.api.get_playoffs(self.game_start.year) + try: + playoffs = await self.api.get_playoffs(self.game_start.year) + except Exception: + log.exception("Error getting playoffs data.") series = playoffs.get_series(self.home, self.away) log.debug("Playoffs series %s", series) em.set_image(url=series.logo or playoffs.logo) @@ -484,7 +487,10 @@ async def game_state_embed(self) -> discord.Embed: away_score=self.away_score, away_shots=self.away_shots ) if self.game_type is GameType.playoffs: - playoffs = await self.api.get_playoffs(self.game_start.year) + try: + playoffs = await self.api.get_playoffs(self.game_start.year) + except Exception: + log.exception("Error getting playoffs data.") series = playoffs.get_series(self.home, self.away) log.debug("Playoffs series %s", series) em.set_image(url=series.logo or playoffs.logo) diff --git a/hockey/standings.py b/hockey/standings.py index 7c0bd98b16..27d2cf54cc 100644 --- a/hockey/standings.py +++ b/hockey/standings.py @@ -158,10 +158,11 @@ class PlayoffSeries: topSeedWins: int bottomSeedRank: int bottomSeedWins: int - winningTeamId: int - losingTeamId: int + year: int + winningTeamId: int = -1 + losingTeamId: int = -1 conferenceAbbrev: Optional[str] = None conferenceName: Optional[str] = None seriesLogo: Optional[str] = None