idac: hotfix round creation

This commit is contained in:
Dniel97 2024-06-13 00:17:38 +02:00
parent 8b9e1f94e6
commit c35e14b640
Signed by untrusted user: Dniel97
GPG Key ID: 6180B3C768FB2E08

View File

@ -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