summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-08-29 23:13:14 +0200
committeremkael <emkael@tlen.pl>2020-08-29 23:13:14 +0200
commit273432ec906586148aa2b348a625f08eb7aea65a (patch)
tree924ea4ee12c4ebbf8257b0a744ec92c7b41d8039
parent65dcab7ae2e5d088fc3112e29fe59bda8fe3ce3d (diff)
Properly reading outcome (winner/loser) team names when teams are pre-selected
-rw-r--r--jfr_playoff/data/info.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/jfr_playoff/data/info.py b/jfr_playoff/data/info.py
index 942e8fb..b3f5a00 100644
--- a/jfr_playoff/data/info.py
+++ b/jfr_playoff/data/info.py
@@ -264,20 +264,24 @@ class MatchInfo(ResultInfo):
def _determine_outcome(self):
if (self.info.teams[0].known_teams == 1) \
and (self.info.teams[1].known_teams == 1):
+ teams = [
+ team.name[max(0, team.selected_team)]
+ for team in self.info.teams
+ ]
if self.info.running == -1:
if self.info.teams[0].score > self.info.teams[1].score:
- self.info.winner = self.info.teams[0].name[0]
- self.info.loser = self.info.teams[1].name[0]
+ self.info.winner = teams[0]
+ self.info.loser = teams[1]
else:
- self.info.loser = self.info.teams[0].name[0]
- self.info.winner = self.info.teams[1].name[0]
+ self.info.loser = teams[0]
+ self.info.winner = teams[1]
elif self.info.running > 0:
if self.info.teams[0].score > self.info.teams[1].score:
- self.info.possible_winner = self.info.teams[0].name[0]
- self.info.possible_loser = self.info.teams[1].name[0]
+ self.info.possible_winner = teams[0]
+ self.info.possible_loser = teams[1]
elif self.info.teams[0].score < self.info.teams[1].score:
- self.info.possible_loser = self.info.teams[0].name[0]
- self.info.possible_winner = self.info.teams[1].name[0]
+ self.info.possible_loser = teams[0]
+ self.info.possible_winner = teams[1]
def _determine_running_link(self):
if self.info.link is None: