From 05fab1f79d4c1f1402c4f9583efdbc3068fe2b1b Mon Sep 17 00:00:00 2001 From: RndName Date: Tue, 6 Jul 2021 11:42:44 +0200 Subject: [PATCH] correct display of turn statistics --- changelog.md | 1 + game/game.py | 1 - game/models/game_stats.py | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index ffd51f2b..1acecb85 100644 --- a/changelog.md +++ b/changelog.md @@ -32,6 +32,7 @@ Saves from 4.0.0 are compatible with 4.1.0. * **[Mission Generation]** The legacy always-available tanker option no longer prevents mission creation. * **[Mission Generation]** Fix occasional KeyError preventing mission generation when all units of the same type in a convoy were killed. * **[UI]** Statistics window tick marks are now always integers. +* **[UI]** Statistics window now shows the correct info for the turn * **[UI]** Toggling custom loadout for an aircraft with no preset loadouts no longer breaks the flight. # 4.0.0 diff --git a/game/game.py b/game/game.py index 11cc45ba..73433aac 100644 --- a/game/game.py +++ b/game/game.py @@ -109,7 +109,6 @@ class Game: # NB: This is the *start* date. It is never updated. self.date = date(start_date.year, start_date.month, start_date.day) self.game_stats = GameStats() - self.game_stats.update(self) self.notes = "" self.ground_planners: dict[int, GroundPlanner] = {} self.informations = [] diff --git a/game/models/game_stats.py b/game/models/game_stats.py index a4d8e623..c2be800f 100644 --- a/game/models/game_stats.py +++ b/game/models/game_stats.py @@ -43,6 +43,10 @@ class GameStats: :param game: Game we want to save the data about """ + # Remove the current turn if its just an update for this turn + if 0 < game.turn < len(self.data_per_turn): + del self.data_per_turn[-1] + turn_data = GameTurnMetadata() for cp in game.theater.controlpoints: