Skip to content

Add Event ready / Completed readiness filters to registrants roster#1925

Merged
maebeale merged 2 commits into
mainfrom
maebeale/registrant-readiness-filter
Jul 4, 2026
Merged

Add Event ready / Completed readiness filters to registrants roster#1925
maebeale merged 2 commits into
mainfrom
maebeale/registrant-readiness-filter

Conversation

@maebeale

@maebeale maebeale commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

🤖 PR, suggested 👤 review level: 📖 Read — readiness PORO + one Status column/filter on the registrants roster; no migrations

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

  • Adds a single Status column (far right) + matching filter to the registrants roster, so admins see at a glance who needs attention before and after a training without manually cross-checking payment, org/facilitator, scholarship, and CE state.
  • One badge, four plain lifecycle steps (chosen over multiple columns because the staff using it aren't technical):
    • 🟠 Not ready — pre-event to-dos outstanding; a two-word reason (e.g. "Payment due", "Org validation", "No license #") shows under the badge, full list in the tooltip
    • 🔵 Ready — cleared for the event
    • 🟣 Certificate pending — attended + tasks done, certificate still to send; a cert-type note ("Registration" / "CE" / "Reg + CE") shows which
    • 🟢 Completed — certificate(s) sent

How did you approach the change?

  • EventRegistrationReadiness PORO computes both checklists + a combined status, returning the specific outstanding reasons so the badge tooltip/subtext and the filter share one source of truth. Reads only preloaded associations (no N+1).
  • Now that main has the CE + certificate system, readiness reads real state via Registerablepaid_in_full? and certificate_sent? on both the registration and its continuing_education_registrations (no more stubs).
  • Filtered in Ruby on the loaded roster (no pagination here), mirroring how the existing attendance filter sits outside the active/inactive counts.

Anything else to add?

# lands (CE payment, certificate-sent tracking). ---

# TODO: no CE payment is tracked yet, so nobody is CE-paid.
def ce_paid?

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: These three are deliberate stubs — CE-paid and both certificate_sent_at fields don't exist yet. Until they land, "Completed" reads false for everyone (by design). Flip each to the real predicate when its feature merges; completion should require both the registration and CE certificate-sent fields.

Comment thread app/controllers/events_controller.rb Outdated
@readiness = @event_registrations.to_h do |registration|
[ registration.id, EventRegistrationReadiness.new(registration, submitted_org_name: @submitted_org_names[registration.registrant_id]) ]
end
if params[:event_ready].in?(%w[ ready not_ready ])

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: Readiness is filtered in Ruby on the already-loaded roster (no pagination on this page) rather than as a SQL scope, since the same per-row computation also drives the badge tooltips. It sits after the active/inactive counts, matching how the existing attendance_status filter is also excluded from those tab counts.

@maebeale maebeale changed the title Add Event ready / Completed readiness filters to registrants roster HOLD: Add Event ready / Completed readiness filters to registrants roster Jun 29, 2026
# and its matching filter. Completion is the final state and wins; otherwise an
# outstanding pre-event to-do means "not ready", and a clear checklist means
# "ready" for the event.
def status

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: Precedence is deliberate: completion wins over the pre-event checklist (a finished registrant shouldn't read "Not ready" just because, say, a balance was never reconciled), then an outstanding pre-event item is "not ready", and a clear checklist is "ready". The roster shows one badge from this and the filter matches it word-for-word.

Copilot AI review requested due to automatic review settings July 4, 2026 15:05
@maebeale maebeale force-pushed the maebeale/registrant-readiness-filter branch from 9769887 to 36efab7 Compare July 4, 2026 15:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a single, combined registrant lifecycle Status (badge + filter) to the event registrants roster, backed by a new EventRegistrationReadiness service that centralizes readiness/completion logic and exposes human-readable issues/reasons for tooltips and filtering.

Changes:

  • Introduces EventRegistrationReadiness PORO to compute :not_ready, :ready, :certificate_due, :completed plus issue/reason strings.
  • Updates Events registrants roster UI to display a new far-right Status column and adds a matching “Status” filter.
  • Adds service + request specs covering the readiness logic and the roster/filter rendering behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/services/event_registration_readiness.rb New readiness/completion PORO used by the roster for status/tooltip/filter decisions.
app/controllers/events_controller.rb Preloads needed associations, batches submitted org names, builds readiness objects, and applies readiness filtering in-memory.
app/views/events/_registrants_search.html.erb Adds the “Status” (readiness) filter select.
app/views/events/_registrants_results.html.erb Adds sortable Status column and renders the readiness badge per row; moves submitted org name mapping to controller-provided ivar.
app/views/event_registrations/_readiness_badge.html.erb New badge partial rendering the status pill + tooltip + optional subtext.
spec/services/event_registration_readiness_spec.rb Unit coverage for readiness/completion checks, status, and reason/issue outputs.
spec/requests/events_spec.rb Request coverage ensuring the roster renders statuses and that readiness filtering works (including invalid filter handling).
AGENTS.md Updates service/spec counts and documents the new service.

Comment on lines +158 to +165
def scholarship_uncreated?
registration.scholarship_requested? && !registration.scholarship?
end

def scholarship_tasks_incomplete?
registration.scholarship? && !registration.scholarship_tasks_met?
end

Comment on lines +47 to +51
def status
return :completed if completed?
return :not_ready unless event_ready?
return :certificate_due if certifiable?
:ready
Squashed for re-integration onto main (which since merged the CE +
certificate system). Reworked in the rebase resolution.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/registrant-readiness-filter branch from 36efab7 to 75dc87d Compare July 4, 2026 18:28
@maebeale maebeale marked this pull request as ready for review July 4, 2026 18:28
Copilot AI review requested due to automatic review settings July 4, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment on lines +409 to +412
<% readiness = @readiness[registration.id] %>
<td class="px-4 py-2 text-sm text-center" data-sort-value="<%= readiness.status %>">
<%= render "event_registrations/readiness_badge",
status: readiness.status,
- "Org validation" now fires purely on whether an organization is linked
  (pending or none). A linked org clears it — a registrant with an org no
  longer reads "Not ready" just for lacking a Facilitator affiliation.
- The Status column sorts by lifecycle rank then reason (a "rank|reason"
  key sorted client-side), so same-status rows group by reason.
- Moved the Edit action to the far-right column, after Status.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale merged commit 4c13d0f into main Jul 4, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/registrant-readiness-filter branch July 4, 2026 19:23
@maebeale maebeale changed the title HOLD: Add Event ready / Completed readiness filters to registrants roster Add Event ready / Completed readiness filters to registrants roster Jul 4, 2026
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.

2 participants