summaryrefslogtreecommitdiff
path: root/jfr_playoff/data.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-01-22 16:06:53 +0100
committeremkael <emkael@tlen.pl>2018-01-22 17:39:41 +0100
commitc06eff1c328a4ec270f15685a945cc3ba5eb612a (patch)
tree67e117e0ab2dde8fc0eefd1a8ce23d02b4e43ae1 /jfr_playoff/data.py
parenta6043f2d7b2cda3ca93e4ba8482d7b64e65ca19e (diff)
Providing default value for match score in config
Diffstat (limited to 'jfr_playoff/data.py')
-rw-r--r--jfr_playoff/data.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/jfr_playoff/data.py b/jfr_playoff/data.py
index 23f82b8..51948cd 100644
--- a/jfr_playoff/data.py
+++ b/jfr_playoff/data.py
@@ -144,6 +144,9 @@ class PlayoffData(object):
else '??' for team in match_teams])
else:
teams[i].name = ''
+ if 'score' in match:
+ for i in range(0, 2):
+ teams[i].score = match['score'][i]
return teams
def get_match_info(self, match):
@@ -176,14 +179,16 @@ class PlayoffData(object):
info.running = int(row[1])
if row[1] >= row[0] - towels[0]:
info.running = 0
- if info.teams[0].score > info.teams[1].score:
- info.winner = info.teams[0].name
- info.loser = info.teams[1].name
- else:
- info.loser = info.teams[0].name
- info.winner = info.teams[1].name
except (mysql.connector.Error, TypeError, KeyError):
pass
+ if (info.running == 0) and \
+ ((info.teams[0].score != 0) or (info.teams[1].score != 0)):
+ if info.teams[0].score > info.teams[1].score:
+ info.winner = info.teams[0].name
+ info.loser = info.teams[1].name
+ else:
+ info.loser = info.teams[0].name
+ info.winner = info.teams[1].name
return info
def prefill_leaderboard(self, teams):