From 349b5941fbedff114b1d6df235cd1f77e359804a Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 24 Jul 2021 21:47:58 +0000 Subject: [PATCH] Add member sorting by recently inactive --- apiserver/apiserver/api/views.py | 3 +++ webclient/src/Members.js | 6 ++++-- webclient/src/light.css | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 4d06825..76e432d 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -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 = [] diff --git a/webclient/src/Members.js b/webclient/src/Members.js index 9d15a33..19acbd4 100644 --- a/webclient/src/Members.js +++ b/webclient/src/Members.js @@ -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 ?