summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-17 13:20:25 +0100
committeremkael <emkael@tlen.pl>2018-02-17 13:20:25 +0100
commitad77849280b2c8231be90349bc4ca6c4c6597d35 (patch)
tree7077237c088fa4f0797ec650228703233a304e3e
parentfef0d2d2651182da000c67e22ad7a6695f856811 (diff)
Ability to define team names for a match manually
-rw-r--r--jfr_playoff/matchinfo.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py
index 1df6305..b566b39 100644
--- a/jfr_playoff/matchinfo.py
+++ b/jfr_playoff/matchinfo.py
@@ -55,8 +55,21 @@ class MatchInfo:
scores_fetched = False
teams_fetched = False
if 'score' in self.config:
- for i in range(0, 2):
- teams[i].score = self.config['score'][i]
+ i = 0
+ for score in self.config['score']:
+ if isinstance(self.config['score'], dict):
+ teams[i].score = self.config['score'][score]
+ try:
+ team_no = int(score)
+ teams[i].name = self.teams[team_no-1][0]
+ except ValueError:
+ teams[i].name = score
+ teams_fetched = True
+ else:
+ teams[i].score = score
+ i += 1
+ if i == 2:
+ break
scores_fetched = True
return scores_fetched, teams_fetched, teams