From c35e14b640586d27c41bc506886c15709bb0f957 Mon Sep 17 00:00:00 2001 From: Dniel97 Date: Thu, 13 Jun 2024 00:17:38 +0200 Subject: [PATCH] idac: hotfix round creation --- titles/idac/schema/rounds.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/titles/idac/schema/rounds.py b/titles/idac/schema/rounds.py index 46c2e9f..1c208de 100644 --- a/titles/idac/schema/rounds.py +++ b/titles/idac/schema/rounds.py @@ -120,24 +120,24 @@ class IDACOnlineRounds(BaseData): self, round_id: int, version: int, round_data: Dict ) -> Optional[int]: - sql = select(round_details).where( - round_details.c.round_id_in_json == round_id - ) + sql = select(round_details).where(round_details.c.round_id_in_json == round_id) result = await self.execute(sql) - rid = result.fetchone() - if rid is None: - tmp = {} - tmp["round_id_in_json"] = round_id - tmp["name"] = round_data["round_event_nm"] - tmp["season"] = version - tmp["start_dt"] = datetime.datetime.fromtimestamp(round_data["start_dt"]) - tmp["end_dt"] = datetime.datetime.fromtimestamp(round_data["end_dt"]) + if result is None: + tmp = { + "round_id_in_json": round_id, + "name": round_data["round_event_nm"], + "season": version, + "start_dt": datetime.fromtimestamp(round_data["start_dt"]), + "end_dt": datetime.fromtimestamp(round_data["end_dt"]), + } sql = insert(round_details).values(**tmp) result = await self.execute(sql) return result.lastrowid + + rid = result.fetchone() return rid["id"] # TODO: get top five players of last round event for Boot/GetConfigData