🤖 From Claude: follow-up noted during the events-IA refactor (PR #2113); out of scope there.
Summary
Two controllers build essentially the same per-registrant CSV row from scratch:
EventsController#event_registration_csv_row (app/controllers/events_controller.rb, ~L876) — the per-event Manage roster export.
Events::EventRegistrationsController#csv_export (app/controllers/event_registrations_controller.rb, ~L365) — the cross-event registrations export.
Both emit the same columns — first name, last name, email, phone, org(s), scholarship (yes/no), scholarship completed, payment status, intends to pay, payment total, and CE status/paid/due — with only minor differences:
- The cross-event export adds an Event column and uses
attendance_status_label; the per-event one omits Event and gates payment on cost_required.
- Org names: the per-event builder derives active-affiliation org names in Ruby; the cross-event one omits orgs.
- CE columns are always present cross-event; conditional (
include_ce) per-event.
They share csv_dollars, allocations_sum, scholarships.any?, payment_status_label, etc. — so the cell logic is duplicated and can drift (a change to how, say, scholarship-completed or CE-due is computed must be made in both).
Proposed approach
Extract a single row/column builder (e.g. an EventRegistrationCsvRow PORO or a shared concern) that takes an EventRegistration plus options (include_event_column:, include_ce:, cost_required:) and returns the header + row. Both controllers call it. Keep the two call sites' column-set differences as explicit options rather than divergent implementations.
Tasks
Out of scope
- No new columns or format changes — pure dedup.
References
🤖 From Claude: follow-up noted during the events-IA refactor (PR #2113); out of scope there.
Summary
Two controllers build essentially the same per-registrant CSV row from scratch:
EventsController#event_registration_csv_row(app/controllers/events_controller.rb, ~L876) — the per-event Manage roster export.Events::EventRegistrationsController#csv_export(app/controllers/event_registrations_controller.rb, ~L365) — the cross-event registrations export.Both emit the same columns — first name, last name, email, phone, org(s), scholarship (yes/no), scholarship completed, payment status, intends to pay, payment total, and CE status/paid/due — with only minor differences:
attendance_status_label; the per-event one omits Event and gates payment oncost_required.include_ce) per-event.They share
csv_dollars,allocations_sum,scholarships.any?,payment_status_label, etc. — so the cell logic is duplicated and can drift (a change to how, say, scholarship-completed or CE-due is computed must be made in both).Proposed approach
Extract a single row/column builder (e.g. an
EventRegistrationCsvRowPORO or a shared concern) that takes anEventRegistrationplus options (include_event_column:,include_ce:,cost_required:) and returns the header + row. Both controllers call it. Keep the two call sites' column-set differences as explicit options rather than divergent implementations.Tasks
Out of scope
References