added notification for existing junior add, modified leaderboard method at every places

This commit is contained in:
abutalib-kiwi
2023-08-28 19:39:39 +05:30
parent df3cab99a5
commit 219bae792e
7 changed files with 56 additions and 36 deletions

View File

@ -259,10 +259,14 @@ class TopJuniorListAPIView(viewsets.ModelViewSet):
return context
def get_queryset(self):
queryset = JuniorPoints.objects.select_related('junior', 'junior__auth').annotate(rank=Window(
expression=Rank(),
order_by=[F('total_points').desc(), 'junior__created_at']
)).order_by('-total_points', 'junior__created_at')
queryset = JuniorPoints.objects.filter(
junior__is_verified=True
).select_related(
'junior', 'junior__auth'
).annotate(rank=Window(
expression=Rank(),
order_by=[F('total_points').desc(), 'junior__created_at'])
).order_by('-total_points', 'junior__created_at')
return queryset
def list(self, request, *args, **kwargs):