Skip to content

Staging into Main#184

Merged
rsmoke merged 2 commits intomainfrom
staging
Feb 16, 2026
Merged

Staging into Main#184
rsmoke merged 2 commits intomainfrom
staging

Conversation

@rsmoke
Copy link
Member

@rsmoke rsmoke commented Feb 16, 2026

This pull request improves the judge dashboard by optimizing database queries related to contest entries, especially for loading entry file attachments and categories. The main focus is on reducing N+1 query issues by eager loading associated data, which will improve performance and efficiency when judges view and rank entries.

Key improvements:

Performance and Query Optimization:

  • Updated the index action in judge_dashboard_controller.rb to eager load category and entry_file_attachment (with blobs) for each entry, reducing N+1 queries when loading contest entries.
  • Modified the _available_entries.html.erb partial to use with_attached_entry_file and eager load category for entries, further minimizing database queries when rendering available entries for judges.
  • Updated the _selected_entries.html.erb partial to eager load category and entry_file_attachment (with blobs) for ranked entries, ensuring efficient data retrieval when displaying selected entries.

Testing and Verification:

  • Added a controller spec to verify that entry file attachments are eager loaded, ensuring that at most two queries are made for attachments and blobs, and preventing N+1 query issues in the judge dashboard.

…eval

- Updated the available entries partial to include associated entry files and categories, optimizing data loading for better performance.
- Modified the selected entries partial to include category and entry file attachments in the EntryRanking query, ensuring all necessary data is preloaded.
- Refined the JudgeDashboardController to include categories and entry file attachments in the entries query, reducing N+1 query issues and improving overall efficiency.

These changes enhance the user experience by providing richer data in the dashboard while optimizing database interactions.
…dController

- Introduced a new test case to verify that entry file attachments are eager loaded in the index action, reducing N+1 query issues.
- The test ensures that the number of SQL queries for attachments does not exceed two, optimizing performance during data retrieval.

These changes enhance the test coverage for the JudgeDashboardController, ensuring efficient loading of associated data.
@rsmoke rsmoke merged commit 8911b58 into main Feb 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant