admin: fix per-row count queries on admin pages
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with the listed admin views and their corresponding controller queries, especially the building.rooms.size and faculty.courses.count calls. Add request specs for the affected admin pages with at least two rows so Prosopite can check them. Done means the per-row count queries are eliminated and the specs pass.
Written by the indexing model from the issue text.
Description
Found in the #654 audit. Low priority: admin pages only.
Problem
Some admin pages run one query for each row:
app/views/admin/buildings/index.html.erb:122:building.rooms.sizefor each building.app/views/admin/faculties/missing_rmp_ids.html.erb:66andapp/views/admin_mailer/missing_rmp_ids_summary.html.erb:18:faculty.courses.countfor each faculty.app/views/admin/faculties/show.html.erb:138.
Prosopite (#673) now raises on N+1 queries in request specs, so a spec with two or more rows on these pages will fail.
Fix
- Use
includesand.size, or a grouped count in the controller. - Add request specs with two or more rows, so Prosopite checks these pages.
Effort: small.
- Dominant language
- Ruby
- Stars
- 4
- Forks
- 0
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 181
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WITCodingClub/calendar-backend
-
Difficulty 1/5 Under an hour Newbie friendliness 67/100
WITCodingClub/calendar-backend#908 ·
Maintainers usually reply within 1 day
-
performance v/6
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
WITCodingClub/calendar-backend#687 ·
Maintainers usually reply within 1 day
-
performance v/6
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
WITCodingClub/calendar-backend#678 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WITCodingClub/calendar-backend#868 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
WITCodingClub/calendar-backend#867 ·
Maintainers usually reply within 1 day
All issues in WITCodingClub/calendar-backend
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Add a dark modeOpenaccessibility enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
samiromer2/Ruby-Consent-Portal#35 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug detail
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
keygen-sh/keygen-api#1161 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day