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': elif self.action == 'create' and sort == 'oldest_overall':
queryset = queryset.filter(application_date__isnull=False) queryset = queryset.filter(application_date__isnull=False)
queryset = queryset.order_by('application_date') 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': elif self.action == 'create' and sort == 'best_looking':
queryset = [] queryset = []

View File

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

View File

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