Deduplicate the registrant CSV row builder (events vs event_registrations exports)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
app/controllers/events_controller.rb の EventsController#event_registration_csv_row と、app/controllers/event_registrations_controller.rb の Events::EventRegistrationsController#csv_export から始めます。両者のヘッダーと行のロジックを比較し、その後、共有 builder の形を決める前に、既存の controller CSV request spec を確認します。完了の条件は、両方の controller が builder を使用し、直接的な builder spec がそのオプションをカバーし、既存の CSV 出力が byte-for-byte で変更されていないことです。
索引モデルが 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分
- マージ済み PR(30日)
- 262
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 が 78 日前に担当しました。 オープンblocked
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rubyforgood/awbw#2095 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
rubyforgood/awbw#2088 ·
メンテナーはふだん 1 日以内に返信
rubyforgood/awbw の issue をすべて見る
似ている issue
-
verified
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 5 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
akitaonrails/ai-book-2026#10 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
zerocracy/judges-action#2984 ·
メンテナーはふだん 1 日以内に返信