Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Extract the events list UNION query out of EventsController

オープン
#2,937 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
66/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rails, ruby
領域
backend, database

調査の方向性

Read EventsController and compare the existing app/queries/DashboardQuery and app/queries/SponsorsSearch patterns. Start with spec/controllers/events_controller_spec.rb and the feature specs touching the events pages; done means the controller has no Arel, behavior remains unchanged, and the specified specs pass.

索引モデルが issue の本文から書いたものです。

説明

refactoring tech debt

Problem

EventsController builds the paginated upcoming/past events listing inside the controller: paginated_events (~80 lines) constructs a raw Arel UNION ALL across workshops, meetings, and events, plus a separate COUNT query and manual Pagy wiring, and load_events re-hydrates AR objects from the returned id/type pairs. fetch_upcoming_events and fetch_past_events are also near-duplicates of each other.

This is query logic, not HTTP coordination, and it makes the controller the largest non-admin one in the app. The repo already has app/queries/ (DashboardQuery, SponsorsSearch) — this work belongs there.

Proposed change

  • Move the UNION ALL construction, count, pagination, and re-hydration into a single query class, e.g. app/queries/events_feed_query.rb, with an upcoming: flag so fetch_upcoming_events / fetch_past_events collapse into one method.
  • Controller keeps only: parse params[:page], call the query, assign for the view.

Acceptance

  • EventsController#upcoming / #past are a few lines each and contain no Arel.
  • Existing behaviour unchanged: same ordering, grouping by date, 20 rows/page, DB-level count and pagination.
  • bundle exec rspec spec/controllers/events_controller_spec.rb (and the feature specs touching the events pages) pass.
主要言語
Ruby
スター
106
フォーク
208
平均マージ
19時間 31分
マージ済み PR(30日)
84

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

codebar/planner のほかの issue

codebar/planner の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。