Implmented course_info query method

This commit is contained in:
UncleJim 2024-01-06 08:52:35 +00:00
parent a2975fc979
commit 39031757f4

View File

@ -764,8 +764,8 @@ class IDACItemData(BaseData):
return result.fetchall() return result.fetchall()
def get_vs_info_by_mode(self, aime_id: int, battle_mode: int) -> Optional[List[Row]]: def get_vs_info_by_mode(self, aime_id: int, battle_mode: int) -> Optional[List[Row]]:
sql = select(vs_info_new).where( sql = select(vs_info).where(
and_(vs_info_new.c.user == aime_id, vs_info_new.c.battle_mode == battle_mode) and_(vs_info.c.user == aime_id, vs_info.c.battle_mode == battle_mode)
) )
result = self.execute(sql) result = self.execute(sql)
@ -773,6 +773,21 @@ class IDACItemData(BaseData):
return None return None
return result.fetchone() return result.fetchone()
#This method returns a list of course_info
def get_vs_course_infos_by_mode(self, aime_id: int, battle_mode: int) -> Optional[List[Row]]:
sql = select(vs_course_info).where(vs_info.c.user == aime_id, vs_info.c.battle_mode == battle_mode)
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
def get_stamps(self, aime_id: int) -> Optional[List[Row]]: def get_stamps(self, aime_id: int) -> Optional[List[Row]]:
sql = select(stamp).where( sql = select(stamp).where(
and_( and_(