Skip to content

Commit

Permalink
[Hockey] Fix an issue with playoffs lookup now missing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
TrustyJAID committed Jun 22, 2024
1 parent b284200 commit 58ab455
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hockey/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions hockey/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions hockey/standings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58ab455

Please sign in to comment.