Extract the events list UNION query out of EventsController
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 66/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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 anupcoming:flag sofetch_upcoming_events/fetch_past_eventscollapse into one method. - Controller keeps only: parse
params[:page], call the query, assign for the view.
Acceptance
EventsController#upcoming/#pastare 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.
- Lenguaje dominante
- Ruby
- Estrellas
- 106
- Forks
- 208
- Merge medio
- 19 h 31 min
- PR fusionados (30 d)
- 84
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de codebar/planner
-
DashboardQuery eager-loads workshop_host with :sponsors in one join (same host-loss trap as #2975)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dual Invitiation issuePosiblemente ocupada @mroderick la tomó hace 3 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
codebar/planner#3008 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de codebar/planner
Issues similares
-
Windows: packaged_agent_ruby? never matches 'Puppet Labs\Puppet', so the openvox gem is not foundAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
-
Falha nos links do postAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
temporalio/sdk-ruby#625 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 94/100
zerocracy/judges-action#2803 ·
Los mantenedores suelen responder en 5 días
-
empty tone.rbAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100