Skip to content

Associate standalone survey submissions with their event so training feedback automatically tracks on the registrants roster (#2749) - #2768

Merged
maebeale merged 1 commit into
rubyforgood:mainfrom
1steve78:pass-event-id-to-survey
Nov 8, 2026
Merged

maebeale merged 1 commit into
rubyforgood:mainfrom
1steve78:pass-event-id-to-survey

Conversation

@1steve78

@1steve78 1steve78 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🤖 suggested review level: 3 Read 📖 event ID param handling and survey completion association

Allows staff to share standalone survey links with an event attached so respondent answers automatically associate with the training and count toward its survey completion columns.

Closes #2749

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

  • Survey completion columns on the registrants roster and onboarding tracker only counted submissions explicitly attached to an event.
  • Training surveys are often filled via standalone links (/f/:slug) outside ticket callouts, leaving those completions unassociated.
  • Adding validated event ID query parameter support (/f/:slug?event=42) lets standalone submissions count toward the correct event without heuristic date matching.

How did you approach the change?

  • Link generation: Added offered survey links to the Forms dropdown menu (_form_actions_menu.html.erb) and updated the form editor's "Live at" link to include ?event=<id> when an event is present.
  • Validation: Added EventSurveyCompletions.survey_allowed_for_event? to ensure only survey-role forms and events that offer or deliver that survey can be associated.
  • Persistence: Passed validated @event through PublicFormsController to PublicFormSubmission, persisting event_id and stamping scholarship survey readiness.
  • Submission flow: Preserved ?event=<id> across form submissions, error re-renders, and the thank-you return link.
  • Completions: Verified EventSurveyCompletions counts event-associated standalone submissions while ignoring other events and event-less submissions.

Anything else to add?

  • Regression test coverage added across requests, view partials, helpers, and services.

@1steve78
1steve78 marked this pull request as ready for review October 21, 2026 07:30
area: registration
display_status: admin_facing
released_on: 2026-10-21
pr_number: 2749

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 2768, right?

Comment thread app/helpers/forms_helper.rb Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment should be updated or removed now?

@1steve78

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I'll correct the pr_number to 2768, update the outdated comment in forms_helper.rb, and resolve the conflicts in public_forms_controller.rb and public_form_submission.rb. I'll rerun the relevant tests and push the fixes.

@1steve78
1steve78 force-pushed the pass-event-id-to-survey branch from b25d651 to 3603ef2 Compare October 25, 2026 12:53
@maebeale

maebeale commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@1steve78 hey there! would you rebase these pr's so we can review and approve?

@1steve78

1steve78 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

sure

@1steve78
1steve78 force-pushed the pass-event-id-to-survey branch from 3603ef2 to 858b66f Compare November 6, 2026 06:54
…feedback automatically tracks on the registrants roster (rubyforgood#2749)
@1steve78
1steve78 force-pushed the pass-event-id-to-survey branch from 858b66f to 8b33795 Compare November 7, 2026 04:00
@1steve78

1steve78 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

@maebeale pls review i have rebased my pr

@maebeale maebeale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution! 🎉

@maebeale
maebeale merged commit 6d7ee6a into rubyforgood:main Nov 8, 2026
3 checks passed
maebeale added a commit that referenced this pull request Nov 8, 2026
…2965)

* Narrow a form's results to any event its submissions were made for

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>

* Add the Features & tips entry for per-event form results

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
maebeale added a commit that referenced this pull request Nov 8, 2026
…2968)

Two loose ends in the event-scoped survey link (#2768), neither of them
visible to a respondent today.

The public form page and its thank-you page read params[:event] /
params[:event_id] directly, so an id the controller had already rejected
— a deleted event, an event whose kind doesn't offer that survey, a
typo — was echoed back into the form action, a hidden field, and the
"Submit another response" link, where it rode along through the next
submission to be rejected again. Read @event instead, which
PublicFormsController#set_event has already validated, so the ?event_id=
alias also normalizes to the canonical ?event= and only one hidden field
is needed.

form_live_view_link sent "Live form" to the event's public registration
page for any form that isn't publicly fillable. That holds for the
event-connected form the link was written for, but a survey form now
reaches the editor with an event it is merely allowed for, whose
registration form belongs to somebody else — an unpublished survey plus
an event_id pointed the admin at an unrelated form. Offer that path only
when the form is connected to the event.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

Count standalone survey submissions toward an event's survey columns

2 participants