summaryrefslogtreecommitdiff
path: root/jfr_playoff/data/info.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-01-05 13:50:05 +0100
committeremkael <emkael@tlen.pl>2020-01-05 13:50:05 +0100
commit856cf764545362dd43cd2f304bd73c4594e1e6e8 (patch)
tree25b7d89758934c1505d4a4775cbace45491b61ea /jfr_playoff/data/info.py
parent8ec9f68131ff3ff6f3dab3af5f27fa25e6d66f45 (diff)
If team list source tournament is not finished, predict_teams settings is respected
Fixes #44
Diffstat (limited to 'jfr_playoff/data/info.py')
-rw-r--r--jfr_playoff/data/info.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/jfr_playoff/data/info.py b/jfr_playoff/data/info.py
index 55cc926..f79499b 100644
--- a/jfr_playoff/data/info.py
+++ b/jfr_playoff/data/info.py
@@ -100,7 +100,8 @@ class MatchInfo(ResultInfo):
matches = {}
- def __init__(self, match_config, teams, database, aliases=None):
+ def __init__(self, match_config, teams, database,
+ aliases=None, starting_positions_certain=True):
ResultInfo.__init__(self, match_config, database)
self.config = match_config
self.teams = teams
@@ -110,6 +111,7 @@ class MatchInfo(ResultInfo):
for team, team_aliases in aliases.iteritems():
for alias in team_aliases:
self.aliases[alias] = team
+ self._starting_positions_certain = starting_positions_certain
self.info = Match()
self._init_info()
self._fetch_match_link()
@@ -193,9 +195,15 @@ class MatchInfo(ResultInfo):
MatchInfo.matches[loser_match].possible_loser
for loser_match in self.config['teams'][i]['loser']]
if 'place' in self.config['teams'][i]:
- match_teams += [
+ placed_teams = [
self.teams[place-1][0]
for place in self.config['teams'][i]['place']]
+ if self._starting_positions_certain:
+ match_teams += placed_teams
+ possible_teams = [None] * len(placed_teams)
+ else:
+ possible_teams += placed_teams
+ match_teams = [None] * len(placed_teams)
teams[i].name = match_teams
teams[i].possible_name = possible_teams
teams[i].known_teams = len([