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