From 0820dd4e3d479dddec7797b2ea9a83da0f62b7cf Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Tue, 25 Apr 2023 15:56:08 -0500 Subject: [PATCH] i3pystatus.scores.nhl: Handle null win/loss values during playoffs (#846) --- i3pystatus/scores/nhl.py | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/i3pystatus/scores/nhl.py b/i3pystatus/scores/nhl.py index 783871f6..6555725a 100644 --- a/i3pystatus/scores/nhl.py +++ b/i3pystatus/scores/nhl.py @@ -284,21 +284,30 @@ def process_game(self, game): 'score', callback=self.zero_fallback, default=0) - ret[f'{team}_wins'] = self.get_nested( - team_data, - 'leagueRecord:wins', - callback=self.zero_fallback, - default=0) - ret[f'{team}_losses'] = self.get_nested( - team_data, - 'leagueRecord:losses', - callback=self.zero_fallback, - default=0) - ret[f'{team}_otl'] = self.get_nested( - team_data, - 'leagueRecord:ot', - callback=self.zero_fallback, - default=0) + ret[f'{team}_wins'] = int( + self.get_nested( + team_data, + 'leagueRecord:wins', + callback=self.zero_fallback, + default=0, + ) + ) + ret[f'{team}_losses'] = int( + self.get_nested( + team_data, + 'leagueRecord:losses', + callback=self.zero_fallback, + default=0, + ) + ) + ret[f'{team}_otl'] = int( + self.get_nested( + team_data, + 'leagueRecord:ot', + callback=self.zero_fallback, + default=0, + ) + ) ret[f'{team}_city'] = self.get_nested( team_data,