Allow sorting members by storage

This commit is contained in:
Tanner Collin 2023-06-03 19:02:58 +00:00
parent b55eb2a62c
commit d7928e7578
2 changed files with 5 additions and 0 deletions

View File

@ -135,6 +135,10 @@ class SearchViewSet(Base, Retrieve):
queryset = queryset.annotate( queryset = queryset.annotate(
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 == 'storage':
queryset = queryset.annotate(
storage_count=Count('user__storage'),
).exclude(storage_count=0).order_by('-storage_count', 'id')
elif sort == 'everyone': elif sort == 'everyone':
queryset = queryset.annotate( queryset = queryset.annotate(
protocoin_sum=Sum('user__transactions__protocoin'), protocoin_sum=Sum('user__transactions__protocoin'),

View File

@ -22,6 +22,7 @@ const memberSorts = {
is_instructor: 'Instructors', is_instructor: 'Instructors',
due: 'Due', due: 'Due',
overdue: 'Overdue', overdue: 'Overdue',
storage: 'Storage',
everyone: 'Everyone', everyone: 'Everyone',
}; };