From 9836a2bf8ae436aafa5a74dcedd9d9578f2ecc6e Mon Sep 17 00:00:00 2001 From: jelanmathewjames Date: Fri, 7 Jun 2024 22:16:25 +0530 Subject: [PATCH] refactor: optimize leaderboard ranking query --- api/launchpad/launchpad_views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/launchpad/launchpad_views.py b/api/launchpad/launchpad_views.py index ce07cbfa..e709b4be 100644 --- a/api/launchpad/launchpad_views.py +++ b/api/launchpad/launchpad_views.py @@ -51,7 +51,7 @@ def get(self, request): ).annotate( rank=Window( expression=RowNumber(), - order_by=F('karma').desc(), F('time_').asc() + order_by=[F('karma').desc(), F('time_').asc()] ) ).order_by("-karma", "time_")