diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 9ff500f..d323df9 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -196,11 +196,29 @@ class MemberViewSet(Base, Retrieve, Update): def unpause(self, request, pk=None): if not is_admin_director(self.request.user): raise exceptions.PermissionDenied() + + today = utils.today_alberta_tz() member = self.get_object() - member.current_start_date = utils.today_alberta_tz() + + difference = utils.today_alberta_tz() - member.paused_date + if difference.days > 370: # give some leeway + logging.info('Member has been away for %s days (since %s), unvetting...', difference.days, member.paused_date) + member.vetted_date = None + member.orientation_date = None + member.lathe_cert_date = None + member.mill_cert_date = None + member.wood_cert_date = None + member.wood2_cert_date = None + member.tormach_cnc_cert_date = None + member.precix_cnc_cert_date = None + member.rabbit_cert_date = None + member.trotec_cert_date = None + + member.current_start_date = today member.paused_date = None if not member.monthly_fees: member.monthly_fees = 55 + member.save() utils.tally_membership_months(member) utils.gen_member_forms(member) @@ -560,6 +578,7 @@ class DoorViewSet(viewsets.ViewSet, List): for card in cards: member = card.user.member if member.paused_date: continue + if not member.vetted_date: continue if not member.is_allowed_entry: continue active_member_cards[card.card_number] = '{} ({})'.format( diff --git a/webclient/src/AdminMembers.js b/webclient/src/AdminMembers.js index 8c6addf..37f1670 100644 --- a/webclient/src/AdminMembers.js +++ b/webclient/src/AdminMembers.js @@ -124,7 +124,7 @@ let prevAutoscan = ''; export function AdminMemberCards(props) { const { token, result, refreshResult } = props; const cards = result.cards; - const startDimmed = Boolean((result.member.paused_date || !result.member.is_allowed_entry) && cards.length); + const startDimmed = Boolean((result.member.paused_date || !result.member.is_allowed_entry || !result.member.vetted_date) && cards.length); const [dimmed, setDimmed] = useState(startDimmed); const [input, setInput] = useState({ active_status: 'card_active' }); const [error, setError] = useState(false); @@ -134,7 +134,7 @@ export function AdminMemberCards(props) { const { id } = useParams(); useEffect(() => { - const startDimmed = Boolean((result.member.paused_date || !result.member.is_allowed_entry) && cards.length); + const startDimmed = Boolean((result.member.paused_date || !result.member.is_allowed_entry || !result.member.vetted_date) && cards.length); setDimmed(startDimmed); }, [result.member]); @@ -298,7 +298,7 @@ export function AdminMemberCards(props) {

- Member paused or not allowed entry, {cards.length} card{cards.length === 1 ? '' : 's'} ignored anyway. + Member paused, unvetted or not allowed entry. {cards.length} card{cards.length === 1 ? '' : 's'} ignored anyway.

@@ -363,15 +363,45 @@ export function AdminMemberPause(props) {

Pause / Unpause Membership
-

Pause members who are inactive, former, or on vacation.

-

{result.member.paused_date ? - + result.member.vetted_date && moment().diff(moment(result.member.paused_date), 'days') > 370 ? + <> +

+ {result.member.preferred_name} has been away for more than a year and will need to be re-vetted according to our + policy. +

+

+ setTold1(v.checked)} + /> +

+

+ setTold2(v.checked)} + /> +

+ + + + : + : <> +

Pause members who are inactive, former, or on vacation.

+