mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-13 11:17:28 +08:00
Diva front end (#150)
Basic diva frontend implemented. Changing name and level string working. And some basic playlog page which needs more data Co-authored-by: = <=> Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/150 Co-authored-by: ThatzOkay <thatzokay@noreply.gitea.tendokyu.moe> Co-committed-by: ThatzOkay <thatzokay@noreply.gitea.tendokyu.moe>
This commit is contained in:
@@ -239,3 +239,23 @@ class DivaScoreData(BaseData):
|
||||
if result is None:
|
||||
return None
|
||||
return result.fetchall()
|
||||
|
||||
async def get_playlogs(self, aime_id: int, idx: int = 0, limit: int = 0) -> Optional[Row]:
|
||||
sql = select(playlog).where(playlog.c.user == aime_id).order_by(playlog.c.date_scored.desc())
|
||||
|
||||
if limit:
|
||||
sql = sql.limit(limit)
|
||||
if idx:
|
||||
sql = sql.offset(idx)
|
||||
|
||||
result = await self.execute(sql)
|
||||
if result:
|
||||
return result.fetchall()
|
||||
|
||||
async def get_user_playlogs_count(self, aime_id: int) -> Optional[int]:
|
||||
sql = select(func.count()).where(playlog.c.user == aime_id)
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
self.logger.warning(f"aimu_id {aime_id} has no scores ")
|
||||
return None
|
||||
return result.scalar()
|
||||
|
||||
Reference in New Issue
Block a user