From 9b140a80e5a267a73d64cc047677dff91bab929e Mon Sep 17 00:00:00 2001 From: YakMM Date: Mon, 3 May 2021 17:44:17 +0200 Subject: [PATCH] Round length fix --- bot/match/classes/match.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bot/match/classes/match.py b/bot/match/classes/match.py index 249cc58..a5be90a 100644 --- a/bot/match/classes/match.py +++ b/bot/match/classes/match.py @@ -131,6 +131,7 @@ def change_check(self, arg): def spin_up(self, p_list): Match._last_match_id += 1 self.__objects.on_spin_up(p_list) + self.__data.on_spin_up() db.set_field("restart_data", 0, {"last_match_id": Match._last_match_id}) @property @@ -159,9 +160,12 @@ def __init__(self, match: Match, data: dict): self.id = 0 self.teams = [None, None] self.base = None - self.round_length = cfg.general["round_length"] + self.round_length = 0 self.round_stamps = list() + def on_spin_up(self): + self.round_length = cfg.general["round_length"] + def get_data(self): dta = dict() dta["_id"] = self.id @@ -175,7 +179,8 @@ def clean(self): self.id = 0 self.teams = [None, None] self.base = None - self.round_stamps = list() + self.round_stamps.clear() + self.round_length = 0 async def push_db(self): await db.async_db_call(db.set_element, "matches", self.id, self.get_data())