summaryrefslogtreecommitdiff
path: root/jfr_playoff/matchinfo.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-10-02 12:41:31 +0200
committeremkael <emkael@tlen.pl>2018-10-02 12:41:31 +0200
commit62fe5244beb1a859b86aae86d784a86b30d86ca9 (patch)
tree8b36d0d0bdd53a65586e4459d80fc77be9044c08 /jfr_playoff/matchinfo.py
parent03ab8b041179daa2ed75966a3c2255e239f8fde7 (diff)
Fetching info about possible outcomes of matches in progress
Diffstat (limited to 'jfr_playoff/matchinfo.py')
-rw-r--r--jfr_playoff/matchinfo.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/jfr_playoff/matchinfo.py b/jfr_playoff/matchinfo.py
index f7a156d..bb13ed9 100644
--- a/jfr_playoff/matchinfo.py
+++ b/jfr_playoff/matchinfo.py
@@ -159,6 +159,7 @@ class MatchInfo:
def __get_config_teams(self, teams):
for i in range(0, 2):
match_teams = []
+ possible_teams = []
if isinstance(self.config['teams'][i], basestring):
teams[i].name = [self.config['teams'][i]]
elif isinstance(self.config['teams'][i], list):
@@ -168,15 +169,22 @@ class MatchInfo:
match_teams += [
MatchInfo.matches[winner_match].winner
for winner_match in self.config['teams'][i]['winner']]
+ possible_teams += [
+ MatchInfo.matches[winner_match].possible_winner
+ for winner_match in self.config['teams'][i]['winner']]
if 'loser' in self.config['teams'][i]:
match_teams += [
MatchInfo.matches[loser_match].loser
for loser_match in self.config['teams'][i]['loser']]
+ possible_teams += [
+ MatchInfo.matches[loser_match].possible_loser
+ for loser_match in self.config['teams'][i]['loser']]
if 'place' in self.config['teams'][i]:
match_teams += [
self.teams[place-1][0]
for place in self.config['teams'][i]['place']]
teams[i].name = match_teams
+ teams[i].possible_name = possible_teams
teams[i].known_teams = len([team for team in match_teams if team is not None])
PlayoffLogger.get('matchinfo').info(
'config scores for match #%d: %s',
@@ -347,6 +355,13 @@ class MatchInfo:
else:
self.info.loser = self.info.teams[0].name[0]
self.info.winner = self.info.teams[1].name[0]
+ 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]
+ 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]
def __get_db_running_link(self, prefix, round_no):
current_segment = int(