From fed502a14a3fc5fe3fcccf5c808e585b4d4ef92a Mon Sep 17 00:00:00 2001 From: ThisBirchWood Date: Sun, 16 Mar 2025 12:21:25 +0100 Subject: [PATCH] UPDATE: Correctly updating round with _update_round() function PATCH: Incorrect max tick value --- models/match.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/models/match.py b/models/match.py index 618b7be..4769cb7 100644 --- a/models/match.py +++ b/models/match.py @@ -13,8 +13,8 @@ class Match: self.round = self.current_tick["team_rounds_total"].values[0] - self.max_tick = game_info.index[-1] - self.game_info = game_info # pd dataframe sorted by tick + self.max_tick = game_info["tick"].max() + self.game_info = game_info.sort_values(by=["tick", "player_steamid"]) # pd dataframe sorted by tick self.tick_rate = tick_rate def _update_player_positions(self) -> None: @@ -35,7 +35,19 @@ class Match: def _update_round(self) -> None: if self.current_tick.empty: return + self.round = self.current_tick["team_rounds_total"].values[0] + + if self.round >= 8: + self.team_1.is_ct = False + self.team_2.is_ct = True + self.team_1.score = int(self.current_tick[self.current_tick["team_num"] == 3]["team_rounds_total"].values[0]) + self.team_2.score = int(self.current_tick[self.current_tick["team_num"] == 2]["team_rounds_total"].values[0]) + else: + self.team_1.is_ct = True + self.team_2.is_ct = False + self.team_1.score = int(self.current_tick[self.current_tick["team_num"] == 2]["team_rounds_total"].values[0]) + self.team_2.score = int(self.current_tick[self.current_tick["team_num"] == 3]["team_rounds_total"].values[0]) def next_tick(self) -> None: self.tick += 1