Deduplicate the registrant CSV row builder (events vs event_registrations exports)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 app/controllers/events_controller.rb 中的 EventsController#event_registration_csv_row 和 app/controllers/event_registrations_controller.rb 中的 Events::EventRegistrationsController#csv_export 开始。比较它们的 header 和 row 逻辑,然后查看现有的 controller CSV request spec,再决定共享 builder 的结构。完成的标准是两个 controller 都使用该 builder,有一个直接的 builder spec 覆盖其 options,并且现有 CSV 输出保持逐字节不变。
由索引模型根据 Issue 内容生成。
描述
🤖 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 oncost_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
- Extract the shared header + row builder.
- Point both controllers at it (preserving each export's current columns exactly).
- Spec the builder directly; keep the existing controller CSV request specs green (byte-for-byte output unchanged).
Out of scope
- No new columns or format changes — pure dedup.
References
- PR #2113 — the events-IA refactor that surfaced this.
- 主要语言
- Ruby
- 星标
- 15
- 派生
- 28
- 平均合并
- 1 天 12 分钟
- 30 天内合并 PR
- 262
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rubyforgood/awbw 的其他 Issue
-
blocked
难度 2/5 1-3 小时 新手友好度 68/100
rubyforgood/awbw#2824 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
rubyforgood/awbw#2822 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
rubyforgood/awbw#2160 ·
维护者通常 1 天内回复
-
Update callout faq defualt text when the new person subscription launches可能已有人在做 @maebeale 于 79 天前认领。 未关闭blocked
难度 2/5 1-3 小时 新手友好度 72/100
rubyforgood/awbw#2095 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
rubyforgood/awbw#2088 ·
维护者通常 1 天内回复
相似的 Issue
-
area:core-lib P2 size:S
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
bug P2
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
Bug: Credit card Plaid link fails for issuers without Liabilities (e.g. Bilt Rewards)可能已有人在做 @WeiqiZhou2002 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
we-promise/sure#4544 ·
维护者通常 1 天内回复