From a0b269284965c2a68d3b3bf32929b2ef22b285b2 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 12 Mar 2022 20:32:44 +0100 Subject: Automatic carry-over calculations for not-yet-run matches --- jfr_playoff/data/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'jfr_playoff/data/__init__.py') 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() -- cgit v1.2.3