Sort "everyone" by protocoin amount

This commit is contained in:
Tanner Collin 2023-05-24 01:30:45 +00:00
parent a94918a8ed
commit dddfd06b24

View File

@ -136,7 +136,10 @@ class SearchViewSet(Base, Retrieve):
pinball_score=Max('user__scores__score'), pinball_score=Max('user__scores__score'),
).exclude(pinball_score__isnull=True).order_by('-pinball_score') ).exclude(pinball_score__isnull=True).order_by('-pinball_score')
elif sort == 'everyone': elif sort == 'everyone':
queryset = queryset.annotate(Count('user__transactions')).order_by('-user__transactions__count', 'id') queryset = queryset.annotate(
protocoin_sum=Sum('user__transactions__protocoin'),
tx_sum=Sum('user__transactions__amount'),
).order_by('-protocoin_sum', '-tx_sum', 'id')
elif sort == 'best_looking': elif sort == 'best_looking':
queryset = [] queryset = []