From 39031757f4a65db75efab3cdad38355fd512bd82 Mon Sep 17 00:00:00 2001 From: UncleJim Date: Sat, 6 Jan 2024 08:52:35 +0000 Subject: [PATCH] Implmented course_info query method --- titles/idac/schema/item.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/titles/idac/schema/item.py b/titles/idac/schema/item.py index b808c6d..d60f620 100644 --- a/titles/idac/schema/item.py +++ b/titles/idac/schema/item.py @@ -764,8 +764,8 @@ class IDACItemData(BaseData): return result.fetchall() def get_vs_info_by_mode(self, aime_id: int, battle_mode: int) -> Optional[List[Row]]: - sql = select(vs_info_new).where( - and_(vs_info_new.c.user == aime_id, vs_info_new.c.battle_mode == battle_mode) + sql = select(vs_info).where( + and_(vs_info.c.user == aime_id, vs_info.c.battle_mode == battle_mode) ) result = self.execute(sql) @@ -773,6 +773,21 @@ class IDACItemData(BaseData): return None 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]]: sql = select(stamp).where( and_(