Add more sorting options
This commit is contained in:
parent
5edf23de0e
commit
66784c457a
|
@ -107,6 +107,18 @@ class SearchViewSet(Base, Retrieve):
|
|||
elif self.action == 'create' and sort == 'recently_inactive':
|
||||
queryset = queryset.filter(paused_date__isnull=False)
|
||||
queryset = queryset.order_by('-paused_date')
|
||||
elif self.action == 'create' and sort == 'is_director':
|
||||
queryset = queryset.filter(is_director=True)
|
||||
queryset = queryset.order_by('application_date')
|
||||
elif self.action == 'create' and sort == 'is_instructor':
|
||||
queryset = queryset.filter(is_instructor=True)
|
||||
queryset = queryset.order_by('application_date')
|
||||
elif self.action == 'create' and sort == 'due':
|
||||
queryset = queryset.filter(status='Due')
|
||||
queryset = queryset.order_by('expire_date')
|
||||
elif self.action == 'create' and sort == 'overdue':
|
||||
queryset = queryset.filter(status='Overdue')
|
||||
queryset = queryset.order_by('expire_date')
|
||||
elif self.action == 'create' and sort == 'best_looking':
|
||||
queryset = []
|
||||
|
||||
|
|
|
@ -11,12 +11,15 @@ import AbortController from 'abort-controller';
|
|||
|
||||
const memberSorts = {
|
||||
recently_vetted: 'Recently Vetted',
|
||||
newest_active: 'Newest Active',
|
||||
newest_overall: 'Newest Overall',
|
||||
best_looking: 'Best Looking',
|
||||
oldest_active: 'Oldest Active',
|
||||
oldest_overall: 'Oldest Overall',
|
||||
recently_inactive: 'Recently Inactive',
|
||||
newest_active: 'Newest',
|
||||
//newest_overall: 'Newest Overall',
|
||||
oldest_active: 'Oldest',
|
||||
//oldest_overall: 'Oldest Overall',
|
||||
recently_inactive: 'Inactive',
|
||||
is_director: 'Directors',
|
||||
is_instructor: 'Instructors',
|
||||
due: 'Due',
|
||||
overdue: 'Overdue',
|
||||
};
|
||||
|
||||
export function MembersDropdown(props) {
|
||||
|
@ -81,6 +84,7 @@ export function Members(props) {
|
|||
const qs = queryString.stringify({ 'q': q });
|
||||
history.replace('/members?' + qs);
|
||||
} else {
|
||||
setResponse(false);
|
||||
history.replace('/members');
|
||||
}
|
||||
};
|
||||
|
@ -108,6 +112,10 @@ export function Members(props) {
|
|||
});
|
||||
}, [search, sort]);
|
||||
|
||||
useEffect(() => {
|
||||
setResponse(false);
|
||||
}, [sort]);
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Header size='large'>Member List</Header>
|
||||
|
@ -142,7 +150,7 @@ export function Members(props) {
|
|||
</p>
|
||||
|
||||
<Header size='medium'>
|
||||
{search.length ? 'Search Results' : memberSorts[sort] + ' Members'}
|
||||
{search.length ? 'Search Results' : memberSorts[sort]}
|
||||
</Header>
|
||||
|
||||
{sort === 'best_looking' ?
|
||||
|
|
Loading…
Reference in New Issue
Block a user