i3pystatus.scores.nhl: Another fix for series wins (#741)
This commit is contained in:
parent
6441081358
commit
071f0ce6fb
@ -308,17 +308,24 @@ class NHL(ScoresBackend):
|
|||||||
callback=lambda x: self.empty_net if x else '')
|
callback=lambda x: self.empty_net if x else '')
|
||||||
|
|
||||||
if game.get('gameType') == 'P':
|
if game.get('gameType') == 'P':
|
||||||
for team in ('home', 'away'):
|
# Calculate wins/losses in current playoff series
|
||||||
# Calculate wins in current series. The win value will be the
|
home_rem = ret['home_wins'] % 4
|
||||||
# total wins thus far in the playoffs, so a positive win count
|
away_rem = ret['away_wins'] % 4
|
||||||
# which is equally divisible by 4 indicates 4 wins (i.e. a
|
|
||||||
# series win). Otherwise, the series win will be the remainder
|
if ret['home_wins'] == ret['away_wins']:
|
||||||
# when dividing total wins by 4.
|
if home_rem == 0:
|
||||||
key = '%s_wins' % team
|
# Both teams have multiples of 4 wins, so series has no
|
||||||
if ret[key] and ret[key] % 4 == 0:
|
# completed games.
|
||||||
ret[key] = 4
|
ret['home_wins'] = ret['away_wins'] = 0
|
||||||
else:
|
else:
|
||||||
ret[key] %= 4
|
ret['home_wins'] = home_rem
|
||||||
|
ret['away_wins'] = away_rem
|
||||||
|
elif ret['home_wins'] > ret['away_wins']:
|
||||||
|
ret['home_wins'] = 4 if home_rem == 0 else home_rem
|
||||||
|
ret['away_wins'] = away_rem
|
||||||
|
else:
|
||||||
|
ret['away_wins'] = 4 if away_rem == 0 else away_rem
|
||||||
|
ret['home_wins'] = home_rem
|
||||||
|
|
||||||
# Series losses are the other team's wins
|
# Series losses are the other team's wins
|
||||||
ret['home_losses'] = ret['away_wins']
|
ret['home_losses'] = ret['away_wins']
|
||||||
|
Loading…
Reference in New Issue
Block a user