Skip to content

Forms: decisions per person (Camping / Ticketing) (#845, #846) - #897

Merged
mbhewitt merged 1 commit into
mainfrom
feat/form-decisions
Nov 29, 2026
Merged

mbhewitt merged 1 commit into
mainfrom
feat/form-decisions

Conversation

@mbhewitt

Copy link
Copy Markdown
Owner

Refs #845, #846. Built from Mew's answers in #census on 2026-11-29 (recorded on both issues).

A form can now have decisions, which FormEditors make for each person from that person's answers.

  • Camping: Camp = Census Lab / Counter Culture / Not this year.
  • Ticketing: Ticket = staff / gift / discount / full price, plus a separate Vehicle pass = full price / gift / none.
  • Driver approval: will use the same mechanism later.

Editor: a Decisions section where each choice can:

  • grant a role,
  • have a capacity,
  • be marked "Email them". Mew wants emails for positive decisions only, so only those choices get the mark.

Answers page:

  • a running count for each choice, compared with its capacity (red when over),
  • a dropdown per person per decision,
  • a Decision filter,
  • decision columns in the CSV.

PUT /api/forms/[formId]/decisions (FormEditor only; only for people who answered the form):

  • grants the chosen choice's role and removes the roles of that decision's other choices, so a change swaps the role,
  • queues email.form-decision once per person per choice. The wording can be edited on /emails.

Migration 035: adds op_forms.decisions (JSON) and a new op_form_decisions table. The table is system-versioned with changed_by, so its history records who decided and when. It is added to actorGuard.

Tests: new e2e test for the role swap, the 403/404/400 guards, emails sent once and only for marked choices, and the history rows. Locally, 39 (4 tests) and 32 pass. Footer 2027.G.00897.C.

🤖 Generated with Claude Code

Mew 2026-11-29: Camping decision grants CensusLabCamp / CounterCultureCamp,
email positive decisions only, FormEditor decides, per person; Ticketing
has ticket + a separate vehicle-pass decision, no email for now.

A form defines decisions (op_forms.decisions JSON: options with optional
role, capacity, email). The answers page gets a dropdown per person per
decision plus counts vs capacity; choosing swaps the decision's roles and
queues email.form-decision once per person per choice when marked.
op_form_decisions is system-versioned with changed_by (who decided, when).
Migration 035. Footer 2027.G.00897.C.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbhewitt
mbhewitt merged commit 043afc3 into main Nov 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant