Skip to content

Show captured question wording for historical form answers#1701

Open
maebeale wants to merge 1 commit into
mainfrom
maebeale/scholarship-form-responses
Open

Show captured question wording for historical form answers#1701
maebeale wants to merge 1 commit into
mainfrom
maebeale/scholarship-form-responses

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

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

When a question's name is edited later, historical submission views were retroactively relabeling already-submitted answers, misrepresenting what each respondent was actually asked. This PR makes every submission view render the wording snapshotted at submission time so editing a question no longer rewrites history.

How did you approach the change?

Added a display_question_label(field, response) helper that returns question_name_when_answered (the wording captured when the answer was saved), falling back to the field's current name only when no snapshot exists (e.g. a question added after this person submitted). Wired it into the public registration show, recipients, form submission, and scholarship submission views so the logic is centralized and consistent.

UI Testing Checklist

  • On a form submission view, reword a question after a response exists and confirm the original wording still shows next to that answer.
  • Add a new question after a submission and confirm it falls back to the current field name.

Anything else to add?

Note: answers created before the question_name_when_answered column existed have a blank snapshot, so they still fall back to the current field name (no backfill). Covered by new helper and request specs.

Editing a question's name later was retroactively relabeling answers that
were already submitted, misrepresenting what each respondent was actually
asked. Render the wording snapshotted at submission time
(question_name_when_answered) instead, falling back to the field's current
name only when no snapshot exists. Centralize this in a
display_question_label helper so every submission view stays consistent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# back to the field's current name when there's no answer on file — e.g. a
# question added after this person submitted.
def display_question_label(field, response)
response&.question_name_when_answered.presence || field&.name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: Fallback to the live field.name is intentional but means answers predating the question_name_when_answered column (blank snapshot) still show the current wording — there's no backfill, only forward capture.

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