Add member sorting by recently inactive

This commit is contained in:
Tanner Collin 2021-07-24 21:47:58 +00:00
parent 403b0be895
commit 349b5941fb
3 changed files with 8 additions and 2 deletions

View File

@ -103,6 +103,9 @@ class SearchViewSet(Base, Retrieve):
elif self.action == 'create' and sort == 'oldest_overall':
queryset = queryset.filter(application_date__isnull=False)
queryset = queryset.order_by('application_date')
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 == 'best_looking':
queryset = []

View File

@ -14,6 +14,7 @@ const memberSorts = {
best_looking: 'Best Looking',
oldest_active: 'Oldest Active',
oldest_overall: 'Oldest Overall',
recently_inactive: 'Recently Inactive',
};
export function MembersDropdown(props) {
@ -59,6 +60,7 @@ export function MembersDropdown(props) {
};
let searchCache = '';
let numShowCache = 20;
export function Members(props) {
const qs = useLocation().search;
@ -66,7 +68,7 @@ export function Members(props) {
const sort = params.get('sort') || 'recently_vetted';
const [response, setResponse] = useState(false);
const [numShow, setNumShow] = useState(20);
const [numShow, setNumShow] = useState(numShowCache);
const searchDefault = {seq: 0, q: searchCache};
const [search, setSearch] = useState(searchDefault);
const { token } = props;
@ -157,7 +159,7 @@ export function Members(props) {
{numShow !== 100 ?
<Button
content='Load More'
onClick={() => setNumShow(100)}
onClick={() => {setNumShow(100); numShowCache = 100;}}
/> : ''
}
</>

View File

@ -48,6 +48,7 @@ body {
min-height: 45rem;
}
.bean,
.photo-404 {
max-width: 100%;
height: auto;