mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-14 09:37:20 +00:00
added notification for existing junior add, modified leaderboard method at every places
This commit is contained in:
@ -68,10 +68,14 @@ def notify_top_junior():
|
||||
task to send notification for top leaderboard junior to all junior's
|
||||
:return:
|
||||
"""
|
||||
junior_points_qs = 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')
|
||||
junior_points_qs = 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')
|
||||
|
||||
prev_top_position = junior_points_qs.filter(position=1).first()
|
||||
new_top_position = junior_points_qs.filter(rank=1).first()
|
||||
|
Reference in New Issue
Block a user