feat: implement Story 4.3 - Returning Participant Detection

Prevent duplicate registrations for the same exchange:

- Check for existing participant with same email (case-insensitive)
- Show friendly message if already registered
- Offer link to request new magic link for access
- Allow same email to register for different exchanges
- Comprehensive test suite with 4 tests

All tests passing (90 total), 91% coverage maintained.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 17:16:31 -07:00
parent 3467d97828
commit 43bfce3913
2 changed files with 234 additions and 0 deletions

View File

@@ -62,6 +62,26 @@ def register(slug: str):
# If explicitly unchecked, it will be False
reminder_enabled = form.reminder_enabled.data
# Check if participant with this email already exists for this exchange
existing_participant = (
db.session.query(Participant)
.filter_by(exchange_id=exchange.id, email=email)
.first()
)
if existing_participant:
# Participant already registered
flash(
"You're already registered for this exchange. "
"If you need access, you can request a new magic link below.",
"info",
)
return render_template(
"participant/register.html",
exchange=exchange,
form=form,
)
# Create participant record
participant = Participant(
exchange_id=exchange.id,