mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 02:16:16 +00:00
added notification for existing junior add, modified leaderboard method at every places
This commit is contained in:
@ -70,10 +70,12 @@ def get_junior_leaderboard_rank(junior_obj):
|
||||
:param junior_obj:
|
||||
:return: junior's position/rank
|
||||
"""
|
||||
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')
|
||||
|
||||
junior = next((query for query in queryset if query.junior == junior_obj), None)
|
||||
|
||||
|
Reference in New Issue
Block a user