JM: Surface onboarding day-attendance checkmarks on the registration edit form#1932
JM: Surface onboarding day-attendance checkmarks on the registration edit form#1932maebeale wants to merge 4 commits into
Conversation
| // Recompute the status from how many day checkboxes are checked, then reflect it | ||
| // in the dropdown (which re-renders the icon and the unsaved hint via update()). | ||
| deriveFromDays() { | ||
| if (!this.activeStatusesValue.includes(this.selectTarget.value)) return |
There was a problem hiding this comment.
🤖 From Claude: Guards the days→status derivation to active statuses so a deliberate cancelled/no_show/transferred_out isn't silently rolled back by toggling a day — mirrors the server-side sync_attendance_status_to_days!.
There was a problem hiding this comment.
Pull request overview
Surfaces per-day attendance checkmarks (Day 1…N) on the single EventRegistration edit form, reusing the same day-count semantics as the Onboarding matrix and keeping the attendance status dropdown in sync via the existing attendance-status Stimulus controller.
Changes:
- Add per-day attendance checkbox UI to
event_registrations/_form, saving via already-permittedDAY_FIELDS. - Extend
attendance-statusStimulus controller to derive an active attendance status (registered→incomplete_attendance→attended) from checked days, while leaving inactive/manual statuses untouched. - Add system specs covering rendering, persistence, status derivation, and the inactive-status guard.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| spec/system/event_registration_edit_spec.rb | Adds system coverage for day checkbox rendering/persistence and status-derivation behavior. |
| app/views/event_registrations/_form.html.erb | Renders per-day attendance checkboxes and wires them into the Stimulus controller with day count + active statuses. |
| app/frontend/javascript/controllers/attendance_status_controller.js | Adds day targets/values and deriveFromDays() to keep the status dropdown consistent with day checkboxes. |
32beabd to
fd6d743
Compare
9ab1d7d to
2bd2f52
Compare
… form The per-day attendance checkboxes only lived on the Onboarding matrix, so an admin editing a single registration couldn't mark days without leaving the page. Surface the same checkmarks beside the status dropdown, and mirror onboarding's behavior so toggling a day rolls the attendance status forward/back (client-side, respecting deliberate inactive states). DAY_FIELDS were already permitted params, so the boxes save with the form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Group them inline with the "View ticket" / "View submission" links instead of under the status dropdown. The attendance-status controller now spans the whole card so the checkmarks still drive the status select. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Push it to the right edge of the meta strip and stack the label over the day chips, per the requested layout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The derivation spec reloaded the record immediately after clicking Save, racing the submit round-trip and occasionally reading the pre-save status. Assert the redirect landed first, matching the sibling persistence spec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2bd2f52 to
67e272f
Compare
|
I missed when tracking for days attended was added but one thing to highlight - during one of the stakeholder meetings, it was emphasized that the majority of the time people attend both days so they wanted to avoid having to track individual days. I'm no sure the exact solution but this does open up more questions that we should ask. |
🤖 suggested review level: 3 Read 📖 small view + Stimulus change; day fields already permitted, status derivation mirrors existing model logic
What is the goal of this PR and why is this important?
How did you approach the change?
event_registrations/_form.html.erb.DAY_FIELDSwere already permitted params, so they save with the form.attendance-statusStimulus controller: toggling a day derives the status the same way onboarding does (registered → incomplete_attendance → attended), and never overrides a deliberate inactive state (cancelled/no_show/transferred_out) — mirrorsEventRegistration#sync_attendance_status_to_days!.Anything else to add?
edit?→manage?), matching the admin-only day-field params.