summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-07-26 12:49:48 +0200
committeremkael <emkael@tlen.pl>2019-07-26 12:49:48 +0200
commitd7deda9e4669f63832193036774b5c3254088840 (patch)
treef2a4e351fdcf0ae9113585ae8df27ceab1acaaad
parent1bd3c0c9de01555435559b242c864fcd2a712579 (diff)
Fallbacks for empty input data
-rw-r--r--jfr_playoff/data.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/jfr_playoff/data.py b/jfr_playoff/data.py
index 95017a2..641a329 100644
--- a/jfr_playoff/data.py
+++ b/jfr_playoff/data.py
@@ -89,7 +89,7 @@ class PlayoffData(object):
def prefill_leaderboard(self, teams):
self.leaderboard = [None] * len(teams)
for team in teams:
- if len(team) > 3:
+ if len(team) > 3 and team[3] is not None:
self.leaderboard[team[3]-1] = team[0]
self.fill_swiss_leaderboard(self.swiss, teams)
PlayoffLogger.get('data').info('leaderboard pre-filled: %s', self.leaderboard)
@@ -167,7 +167,7 @@ class PlayoffData(object):
max([
len(phase['matches']) + len(phase.get('dummies', []))
for phase in self.phases
- ])
+ ] or [0])
)
PlayoffLogger.get('data').info('grid dimensions: %s', dimensions)
return dimensions