Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Extract the events list UNION query out of EventsController

Aperta
#2,937 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
66/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rails, ruby
Ambito
backend, database

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Ruby
Stelle
106
Fork
208
Merge medio
19h 31m
PR unite (30g)
84

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di codebar/planner

Tutte le issue di codebar/planner

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.