feat(scores): only return best score per user
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from app.api_base import BaseSchema
|
||||
|
||||
from ninja.pagination import PageNumberPagination as _PageNumberPagination
|
||||
|
||||
from app.api_base import BaseSchema
|
||||
|
||||
|
||||
class PageNumberPagination(_PageNumberPagination):
|
||||
class Input(_PageNumberPagination.Input, BaseSchema):
|
||||
|
||||
@@ -8,8 +8,8 @@ from ninja.pagination import paginate
|
||||
from app.api_base import CamelCaseRouter
|
||||
from scores.models import Score, Version
|
||||
|
||||
from .schemas import ScoreIn, ScoreOut
|
||||
from .pagination import PageNumberPagination
|
||||
from .schemas import ScoreIn, ScoreOut
|
||||
|
||||
router = CamelCaseRouter()
|
||||
|
||||
@@ -42,4 +42,4 @@ def list_scores(
|
||||
x_game_version: GameVersionHeader = None,
|
||||
) -> QuerySet[Score]:
|
||||
version = resolve_version(x_game_version)
|
||||
return Score.objects.filter(version=version)
|
||||
return Score.objects.filter(version=version).best_per_username().with_rank()
|
||||
|
||||
Reference in New Issue
Block a user