From 273432ec906586148aa2b348a625f08eb7aea65a Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 29 Aug 2020 23:13:14 +0200 Subject: Properly reading outcome (winner/loser) team names when teams are pre-selected --- jfr_playoff/data/info.py | 20 ++++++++++++-------- 1 file 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: -- cgit v1.2.3