Skip to content

Add per-form results aggregator page - #2315

Merged
maebeale merged 5 commits into
mainfrom
maebeale/form-results-aggregator
Aug 22, 2026
Merged

Add per-form results aggregator page#2315
maebeale merged 5 commits into
mainfrom
maebeale/form-results-aggregator

Conversation

@maebeale

@maebeale maebeale commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 new read-only reporting page + one PORO; main risk is answer-value tallying

What is the goal of this PR and why is this important?

Forms have a submissions list but no rolled-up view of the answers.

  • New Results page per form (/forms/:id/results) that aggregates every submission, question by question, in form order.
  • Reuses the roster events/_breakdown_card so it reads as one reporting family.

How did you approach the change?

Aggregation (FormResponseAggregator PORO)

  • Selectable questions → [label, count] tallies. Sector/age-group ids resolved to names; multi-select split on ", ".
  • Other: <text> write-ins tally under the base option and surface as a separate written-in list.
  • Free-text questions → newest-first answer lists (submitter + date, capped at 25 with a "view all" link). File questions → a count.
  • One query for all answers + one pluck each for sectors/categories; no N+1.

Page

  • Chart type auto-picks: single-select ≤6 options → pie, else bar; multi-select → bar.
  • Summary tiles (submissions / respondents / questions) + date range; empty state when no submissions.
  • Cards laid out as CSS masonry columns (1 / 2 / 3 by breakpoint) so differing-height cards pack tightly instead of leaving gaps beside tall charts.

Navigation

  • Forms index → new Results link.
  • Results → View responses (form submissions index prefiltered by form).
  • Added form_results return-to branches so the submissions index/show eyebrows return to Results.

Dev data

  • db/seeds/dev/form_results_showcase.rb (task db:seed:form_results_showcase, part of db:seed:dev): one standalone form exercising every field type + ~30 varied submissions, so the page has rich data to eyeball.

Anything else to add?

  • Added a Features & tips seed entry (Reporting area).
  • Specs: FormResponseAggregator service spec, request specs for the new action, and page_bg_class alignment.

🤖 Generated with Claude Code

@maebeale
maebeale force-pushed the maebeale/form-results-aggregator branch from 7eef0b2 to 2b85ccf Compare August 22, 2026 12:35
@maebeale
maebeale marked this pull request as ready for review August 22, 2026 12:36
maebeale and others added 5 commits August 22, 2026 11:39
Forms had a submissions list but no way to see the answers rolled up.
The new /forms/:id/results page aggregates every submission question by
question — selects/checkboxes as charts with count+percentage legends,
free-text as newest-first answer lists, files as counts — reusing the
roster breakdown card so it reads as one reporting family.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The results grid was a fixed 2-column layout, so a short card next to a
tall chart left dead space. Switch to CSS multi-column (masonry) so cards
pack tightly and fill the width. Add a dev seed form exercising every
field type with ~30 varied submissions so the page has rich data.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Even when a question has 25 or fewer responses, keep a direct path to the
full filterable submissions list.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ndex

- Reuse a shared "View all N responses" footer across select, text, and
  file result cards (via an optional footer slot on _breakdown_card).
- Show it even when a question has 25 or fewer answers.
- Form submissions index Event column now reads "<event name> · Month Year".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- State fields (mailing_state/organization_state/ce_license_issuing_state)
  chart as a US choropleth, country fields as a world map — same controllers
  as the registrant breakdowns, matched off field_identifier so free-text
  answers still map.
- Add "View all N responses" to the written-in answers sub-card.
- Showcase seed gains state + country fields so the maps have data.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/form-results-aggregator branch from 2b85ccf to 4734be4 Compare August 22, 2026 15:44
@maebeale
maebeale merged commit dbd37d1 into main Aug 22, 2026
3 checks passed
@maebeale
maebeale deleted the maebeale/form-results-aggregator branch August 22, 2026 15:59
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