feat: require photo + division field, fix coach interstitial #45

Merged
forgejo_admin merged 2 commits from 44-phase-3c-form-improvements into main 2026-03-11 00:38:37 +00:00

Summary

Phase 3c registration form improvements: adds a required division dropdown (boys/girls), makes the player photo required for new registrations (skipped for returning players who already uploaded one), fixes the coach Stripe interstitial guidance, adds tryout details to confirmation emails, and adds an is_paid safety net for the token flow.

Changes

  • src/basketball_api/models.py -- Added Division enum (boys/girls) and division nullable column on the Player model
  • src/basketball_api/routes/register.py -- Added required division dropdown with prefill support; made photo required (with has_photo skip for returning players); added is_paid=True safety net for token flow so paid parents via token never see "Payment Required"; added division to form handling, prefill, and player save
  • src/basketball_api/routes/coach.py -- Updated Stripe interstitial: website row now says "skip / I don't have a website" instead of a URL; added product description row with AAU basketball coaching description
  • src/basketball_api/services/email.py -- Added tryout details block (Friday March 13, 5:30 PM registration, 6 PM tryouts, Kongo Basketball Gym address) to both plain text and HTML email templates
  • alembic/versions/e09c9e678004_add_division_column_to_players.py -- Migration adding the division enum type and nullable column to players table
  • tests/test_models.py -- Added Division enum value test, division field assertions for Player create/read
  • tests/test_register.py -- Added name="division" field presence check, invalid division validation test, division save test

Test Plan

  • Run pytest tests/ with a local Postgres (tests pass import checks; DB-dependent tests require running Postgres)
  • Visit /register?token=<valid_token> -- verify division dropdown appears, photo shows "already uploaded" if player has photo_url
  • Visit /register (walk-up) -- verify division dropdown is required, photo is required
  • Submit form with invalid division value -- verify 400 error
  • Submit form via token flow -- verify confirmation always shows "Payment Received" (never "Payment Required")
  • Visit /coach/signup and submit -- verify Stripe interstitial shows "skip website" and product description rows
  • Trigger a confirmation email -- verify tryout details (date, time, location) appear in both plain text and HTML

Review Checklist

  • Ruff lint passes (ruff check src/ tests/)
  • Ruff format passes (ruff format --check src/ tests/)
  • Migration has proper upgrade and downgrade
  • Division column is nullable (backward compatible)
  • Tests updated for new fields
  • Closes #44
  • Plan: plan-2026-03-08-tryout-prep
## Summary Phase 3c registration form improvements: adds a required division dropdown (boys/girls), makes the player photo required for new registrations (skipped for returning players who already uploaded one), fixes the coach Stripe interstitial guidance, adds tryout details to confirmation emails, and adds an is_paid safety net for the token flow. ## Changes - **`src/basketball_api/models.py`** -- Added `Division` enum (boys/girls) and `division` nullable column on the Player model - **`src/basketball_api/routes/register.py`** -- Added required division dropdown with prefill support; made photo required (with `has_photo` skip for returning players); added `is_paid=True` safety net for token flow so paid parents via token never see "Payment Required"; added division to form handling, prefill, and player save - **`src/basketball_api/routes/coach.py`** -- Updated Stripe interstitial: website row now says "skip / I don't have a website" instead of a URL; added product description row with AAU basketball coaching description - **`src/basketball_api/services/email.py`** -- Added tryout details block (Friday March 13, 5:30 PM registration, 6 PM tryouts, Kongo Basketball Gym address) to both plain text and HTML email templates - **`alembic/versions/e09c9e678004_add_division_column_to_players.py`** -- Migration adding the division enum type and nullable column to players table - **`tests/test_models.py`** -- Added Division enum value test, division field assertions for Player create/read - **`tests/test_register.py`** -- Added `name="division"` field presence check, invalid division validation test, division save test ## Test Plan - [ ] Run `pytest tests/` with a local Postgres (tests pass import checks; DB-dependent tests require running Postgres) - [ ] Visit `/register?token=<valid_token>` -- verify division dropdown appears, photo shows "already uploaded" if player has photo_url - [ ] Visit `/register` (walk-up) -- verify division dropdown is required, photo is required - [ ] Submit form with invalid division value -- verify 400 error - [ ] Submit form via token flow -- verify confirmation always shows "Payment Received" (never "Payment Required") - [ ] Visit `/coach/signup` and submit -- verify Stripe interstitial shows "skip website" and product description rows - [ ] Trigger a confirmation email -- verify tryout details (date, time, location) appear in both plain text and HTML ## Review Checklist - [x] Ruff lint passes (`ruff check src/ tests/`) - [x] Ruff format passes (`ruff format --check src/ tests/`) - [x] Migration has proper upgrade and downgrade - [x] Division column is nullable (backward compatible) - [x] Tests updated for new fields ## Related - Closes #44 - Plan: `plan-2026-03-08-tryout-prep`
- Add Division enum (boys/girls) and division column on Player model
- Add division dropdown (required) to registration form with prefill support
- Make photo required for new registrations, skip for returning players with existing photo
- Add is_paid=True safety net for token flow (token = already paid via Stripe)
- Fix coach Stripe interstitial: remove website URL, add "skip website" and product description rows
- Add tryout details (date, time, location) to both plain text and HTML confirmation emails
- Add Alembic migration for division column (nullable, enum type)
- Update tests: Division enum, division form field, invalid division validation

Closes #44

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
refactor: move Division import to top-level in register.py
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
91cbdfeaa6
Moves the inline Division import to the top-level imports block for
consistency with how TeamPreference is imported.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
forgejo_admin deleted branch 44-phase-3c-form-improvements 2026-03-11 00:38:37 +00:00
Sign in to join this conversation.
No description provided.