feat: implement reminder preferences and withdrawal (Stories 6.3, 6.2)
Implement Phase 3 participant self-management features: Story 6.3 - Reminder Preferences: - Add ReminderPreferenceForm to participant forms - Add update_preferences route for preference updates - Update dashboard template with reminder preference toggle - Participants can enable/disable reminder emails at any time Story 6.2 - Withdrawal from Exchange: - Add can_withdraw utility function for state validation - Create WithdrawalService to handle withdrawal process - Add WithdrawForm with explicit confirmation requirement - Add withdraw route with GET (confirmation) and POST (process) - Add withdrawal confirmation email template - Update dashboard to show withdraw link when allowed - Withdrawal only allowed before registration closes - Session cleared after withdrawal, user redirected to registration All acceptance criteria met for both stories. Test coverage: 90.02% (156 tests passing) Linting and type checking: passed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,3 +53,24 @@ def can_update_profile(participant: "Participant") -> bool:
|
||||
exchange = participant.exchange
|
||||
allowed_states = ["draft", "registration_open", "registration_closed"]
|
||||
return exchange.state in allowed_states
|
||||
|
||||
|
||||
def can_withdraw(participant: "Participant") -> bool:
|
||||
"""Check if participant can withdraw from the exchange.
|
||||
|
||||
Withdrawals are only allowed before registration closes.
|
||||
After that, admin intervention is required.
|
||||
|
||||
Args:
|
||||
participant: The participant to check
|
||||
|
||||
Returns:
|
||||
True if withdrawal is allowed, False otherwise
|
||||
"""
|
||||
# Already withdrawn
|
||||
if participant.withdrawn_at is not None:
|
||||
return False
|
||||
|
||||
exchange = participant.exchange
|
||||
allowed_states = ["draft", "registration_open"]
|
||||
return exchange.state in allowed_states
|
||||
|
||||
Reference in New Issue
Block a user