Repository navigation
Narrow a form's results to any event its submissions were made for - #2965
Merged
Merged
Conversation
The results rollup honored its event filter only for an event connected to the form through event_forms, and the picker offered only those. A standalone form has no event_forms rows, so for the surveys shared as /f/:slug?event= (#2768) and the on-demand agreement — both of which stamp an event on the submission — the filter was dead by construction: staff could see a training's survey responses on the roster but never roll them up on their own. Define the filterable events as the ones the form's own submissions were made for, one definition for the picker and the param check. Standalone forms gain the filter, and an event-connected form no longer offers events with nothing to show. The Results subnav tab now carries event_id like the Edit tabs, and the results page sets @dashboard_event, so the event an admin arrived with survives a trip through the rollup. Closes #2963 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator
Author
|
Added the Features & tips seed ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2963. Scope picked per the recommendation on that issue.
Problem
FormsController#resultshonored its event filter only for an event connected to the form throughevent_forms, and the picker offered that same set:A standalone form has no
event_formsrows, so for the surveys shared as/f/:slug?event=(#2768) and for the on-demand agreement — both of which stamp an event on the submission — the filter was dead by construction. Staff could see a training's survey responses on the registrants roster but never roll them up on their own.Change
Event.where(id: @form.form_submissions.select(:event_id))), one definition shared by the picker and the param check. Standalone forms gain the filter; an event-connected form no longer offers connected events with no submissions, which only ever filtered to an empty rollup. The existing.many?gate still hides the picker for a single-event form.event_idlike the Edit tabs already do, andresultsrunsset_dashboard_event, so the event an admin arrived with survives a trip through the rollup instead of being dropped on one tab out of three.Changes
app/controllers/forms_controller.rb,app/helpers/forms_helper.rb,app/views/forms/results.html.erbevent_idwith no submissions is ignored; the subnav keeps the event. Three existing filter specs now create the submissions they imply, since connected-but-empty events no longer appear.Testing
spec/requests/forms_spec.rb(166), plusspec/helpers/forms_helper_spec.rb,spec/requests/{form_submissions,form_answers,public_forms}_spec.rb,spec/services/form_response_aggregator_spec.rb,spec/decorators/form_decorator_spec.rb— 357 examples, 0 failures. Rubocop clean.🤖 Generated with Claude Code