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:
ThatzOkay
2024-06-22 02:03:02 +00:00
committed by Hay1tsme
parent 3741c286f8
commit 7aa3cf82f1
9 changed files with 704 additions and 2 deletions

View File

@@ -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()