summaryrefslogtreecommitdiff
path: root/jfr_playoff/data/__init__.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2022-03-12 20:32:44 +0100
committeremkael <emkael@tlen.pl>2022-03-12 20:32:44 +0100
commita0b269284965c2a68d3b3bf32929b2ef22b285b2 (patch)
tree984121c33b6a01b5bf2d94d74f02392f3b80f84a /jfr_playoff/data/__init__.py
parent9ea9dba5dba306730e3fbdd3815c26f551032566 (diff)
Automatic carry-over calculations for not-yet-run matches
Diffstat (limited to 'jfr_playoff/data/__init__.py')
-rw-r--r--jfr_playoff/data/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/jfr_playoff/data/__init__.py b/jfr_playoff/data/__init__.py
index b5c9ceb..88e9f24 100644
--- a/jfr_playoff/data/__init__.py
+++ b/jfr_playoff/data/__init__.py
@@ -1,4 +1,5 @@
from cached_property import cached_property
+from decimal import Decimal
from jfr_playoff.db import PlayoffDB
from jfr_playoff.dto import Phase
@@ -34,6 +35,8 @@ class PlayoffData(object):
self.aliases = settings.get('team_aliases')
self._predict_teams = int(settings.get('page').get(
'team_boxes', {}).get('predict_teams', 0)) > 0
+ self._calculate_carry_over = Decimal(settings.get('page').get(
+ 'team_boxes', {}).get('auto_carryover', 0.0))
self.grid = []
self.match_info = {}
self.leaderboard = []
@@ -88,7 +91,8 @@ class PlayoffData(object):
match_info = MatchInfo(
match, teams, self.database,
self.aliases,
- certain_starting_positions)
+ certain_starting_positions,
+ self._calculate_carry_over)
if 'link' in phase:
match_info.set_phase_link(phase['link'])
self.match_info[match['id']] = match_info.get_info()