Extract the events list UNION query out of EventsController
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 66/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Ruby
- Star
- 106
- Fork
- 208
- Merge trung bình
- 19 giờ 31 phút
- Pull request đã merge (30 ngày)
- 84
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codebar/planner
-
DashboardQuery eager-loads workshop_host with :sponsors in one join (same host-loss trap as #2975)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Dual Invitiation issueCó thể đã có người làm @mroderick đã nhận 3 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
codebar/planner#3008 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codebar/planner
Issue tương tự
-
Windows: packaged_agent_ruby? never matches 'Puppet Labs\Puppet', so the openvox gem is not foundĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Falha nos links do postĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
temporalio/sdk-ruby#625 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 94/100
zerocracy/judges-action#2803 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
empty tone.rbĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100