fix(score): sort mods to ensure to find scores
This commit is contained in:
@@ -6,7 +6,7 @@ from typing import Literal
|
||||
from app.database.pp_best_score import PPBestScore
|
||||
from app.database.score import Score, get_leaderboard
|
||||
from app.dependencies.database import get_db
|
||||
from app.models.mods import int_to_mods, mods_to_int
|
||||
from app.models.mods import int_to_mods, mod_to_save, mods_to_int
|
||||
from app.models.score import GameMode, LeaderboardType
|
||||
|
||||
from .router import AllStrModel, router
|
||||
@@ -172,7 +172,7 @@ async def get_scores(
|
||||
beatmap_id,
|
||||
GameMode.from_int_extra(ruleset_id),
|
||||
LeaderboardType.GLOBAL,
|
||||
[mod["acronym"] for mod in int_to_mods(mods)],
|
||||
mod_to_save(int_to_mods(mods)),
|
||||
limit=limit,
|
||||
)
|
||||
return [await V1Score.from_db(score) for score in scores]
|
||||
|
||||
@@ -242,7 +242,13 @@ async def get_beatmap_scores(
|
||||
)
|
||||
|
||||
all_scores, user_score, count = await get_leaderboard(
|
||||
db, beatmap_id, mode, type=type, user=current_user, limit=limit, mods=mods
|
||||
db,
|
||||
beatmap_id,
|
||||
mode,
|
||||
type=type,
|
||||
user=current_user,
|
||||
limit=limit,
|
||||
mods=sorted(mods),
|
||||
)
|
||||
|
||||
user_score_resp = await ScoreResp.from_db(db, user_score) if user_score else None
|
||||
|
||||
Reference in New Issue
Block a user