mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-15 12:17:28 +08:00
mai2: add basic webui
This commit is contained in:
@@ -398,3 +398,23 @@ class Mai2ScoreData(BaseData):
|
||||
if result is None:
|
||||
return None
|
||||
return result.fetchall()
|
||||
|
||||
async def get_playlogs(self, user_id: int, idx: int = 0, limit: int = 0) -> Optional[List[Row]]:
|
||||
sql = playlog.select(playlog.c.user == user_id)
|
||||
|
||||
if limit:
|
||||
sql = sql.limit(limit)
|
||||
if idx:
|
||||
sql = sql.offset(idx * limit)
|
||||
|
||||
result = await self.execute(sql)
|
||||
if result:
|
||||
return result.fetchall()
|
||||
|
||||
async def get_user_playlogs_count(self, aime_id: int) -> Optional[Row]:
|
||||
sql = select(func.count()).where(playlog.c.user == aime_id)
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
self.logger.warning(f"aime_id {aime_id} has no playlog ")
|
||||
return None
|
||||
return result.scalar()
|
||||
|
||||
Reference in New Issue
Block a user