fix(playcount): show the sum of all users' playcount in BeatmapResp/BeatmapsetResp

This commit is contained in:
MingxuanGame
2025-10-04 10:50:33 +00:00
parent 38671cd471
commit 6f522847ec
4 changed files with 72 additions and 6 deletions

View File

@@ -193,11 +193,9 @@ class BeatmapResp(BeatmapBase):
if session:
beatmap_["playcount"] = (
await session.exec(
select(func.count())
.select_from(BeatmapPlaycounts)
.where(BeatmapPlaycounts.beatmap_id == beatmap.id)
select(func.sum(BeatmapPlaycounts.playcount)).where(BeatmapPlaycounts.beatmap_id == beatmap.id)
)
).one()
).first() or 0
beatmap_["passcount"] = (
await session.exec(
select(func.count())