3
2
forked from Dniel97/artemis

implement new vs_info saving method

This commit is contained in:
UncleJim 2024-01-06 14:04:47 +00:00
parent a42993aca7
commit f225b732f2

View File

@ -780,13 +780,7 @@ class IDACItemData(BaseData):
result = self.execute(sql)
if result is None:
return None
d, a = {}, []
for row in result:
for column, value in row.items():
d = {**d, **{column: value}}
a.append(d)
return a
return result.fetchall()
def get_stamps(self, aime_id: int) -> Optional[List[Row]]:
sql = select(stamp).where(
@ -988,7 +982,7 @@ class IDACItemData(BaseData):
vs_info_data["user"] = aime_id
vs_info_data["battle_mode"] = battle_mode
sql = insert(vs_info_new).values(**vs_info_data)
sql = insert(vs_info).values(**vs_info_data)
conflict = sql.on_duplicate_key_update(**vs_info_data)
result = self.execute(conflict)
@ -997,6 +991,19 @@ class IDACItemData(BaseData):
return None
return result.lastrowid
def put_vs_course_info(self, aime_id: int, battle_mode: int, course_info_data: Dict) -> Optional[int]:
course_info_data["user"] = aime_id
course_info_data["battle_mode"] = battle_mode
sql = insert(vs_course_info).values(**course_info_data)
conflict = sql.on_duplicate_key_update(**course_info_data)
result = self.execute(conflict)
if result is None:
self.logger.warn(f"put_vs_course_info: Failed to update! aime_id: {aime_id}")
return None
return result.lastrowid
def put_stamp(
self, aime_id: int, stamp_data: Dict
) -> Optional[int]: