Extract the events list UNION query out of EventsController
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 66/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Ruby
- Estrelas
- 105
- Forks
- 206
- Merge médio
- 19h 31min
- PRs com merge (30d)
- 84
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de codebar/planner
-
DashboardQuery eager-loads workshop_host with :sponsors in one join (same host-loss trap as #2975)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
Dual Invitiation issueTalvez já em andamento @mroderick assumiu há 2 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 42/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 28/100
codebar/planner#3008 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de codebar/planner
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
thewca/worldcubeassociation.org#16088 ·
Mantenedores costumam responder em até 1 dia
-
cocoapods: bundled activesupport raises `unknown keyword: quirks_mode` once json 3 is installedAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Homebrew/homebrew-core#319232 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia
-
enhancement help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
ecosyste-ms/repos#1215 ·
Mantenedores costumam responder em até 1 dia