From 602564f084d9d9287bdd95d3ebc6cd7fe1c3e1c7 Mon Sep 17 00:00:00 2001 From: Peter Law Date: Sat, 16 Nov 2024 19:43:09 +0000 Subject: [PATCH] Add overlooked movement point handling --- scoring/score.py | 4 +++- scoring/tests/test_scoring.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/scoring/score.py b/scoring/score.py index b4e4230..d9f1a92 100644 --- a/scoring/score.py +++ b/scoring/score.py @@ -74,10 +74,12 @@ def calculate_scores(self): scores = {} for tla, info in self._teams_data.items(): - scores[tla] = sum( + district_score = sum( self.score_district_for_zone(name, district, info['zone']) for name, district in self._districts.items() ) + movement_score = 1 if info.get('left_starting_zone') else 0 + scores[tla] = district_score + movement_score return scores diff --git a/scoring/tests/test_scoring.py b/scoring/tests/test_scoring.py index 055d470..fc42fa8 100644 --- a/scoring/tests/test_scoring.py +++ b/scoring/tests/test_scoring.py @@ -97,6 +97,16 @@ def test_template(self): # Scoring logic + def test_left_starting_zone(self) -> None: + self.teams_data['GGG']['left_starting_zone'] = True + self.assertScores( + { + 'GGG': 1, + 'OOO': 0, + }, + self.districts, + ) + def test_outer_single(self) -> None: self.districts['outer_nw']['highest'] = 'G' self.districts['outer_nw']['pallets'] = 'G' @@ -194,6 +204,7 @@ def test_central_highest(self) -> None: ) def test_mixed(self) -> None: + self.teams_data['OOO']['left_starting_zone'] = True self.districts['outer_sw']['highest'] = 'O' self.districts['outer_sw']['pallets'] = 'O' self.districts['inner_sw']['highest'] = 'G'