Allow sorting members by storage
This commit is contained in:
parent
b55eb2a62c
commit
d7928e7578
|
@ -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'),
|
||||||
|
|
|
@ -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',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user