Skip to content

Staging into Main#182

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

Staging into Main#182
rsmoke merged 17 commits intomainfrom
staging

Conversation

@rsmoke
Copy link
Member

@rsmoke rsmoke commented Feb 16, 2026

This pull request introduces a "Notify Completed Evaluations" feature for judges, improves the user experience when ranking/unranking entries, and optimizes backend queries for the judge dashboard. Judges can now notify contest contacts when they've finished their evaluations, and the UI provides clearer feedback during ranking actions. Several backend and policy updates support these changes.

New judge notification feature:

  • Judges can now notify the contest contact upon completing their evaluations for a judging round. This includes a new notify_completed action in JudgingRoundsController, mailer (JudgeCompletedEvaluationsMailer), and email templates (HTML and text) to inform the contest contact with judge and contest details. The judge's email is set as the reply-to address.
  • The judge dashboard UI now shows a "I've completed my evaluations" button, enabled only when the required number of entries have been ranked.

Backend optimizations and policy updates:

  • The judge dashboard controller precomputes ranked counts and finalized status per judging round to avoid N+1 queries, improving page performance.
  • The ContestInstancePolicy adds a notify_completed? permission and updates ranking/finalization checks to use judging_open? with the current user.

Ranking and unranking improvements:

  • The update_rankings logic now correctly handles unranking (removing a rank), comment-only updates, and preserves comments when the rank is omitted.
  • The judge dashboard now accurately reflects finalized status using precomputed data.

User experience enhancements for ranking UI:

  • Loading overlays and slow connection warnings are improved for entry cards during ranking/unranking actions, with better overlay management and per-element timeout tracking.

Miscellaneous:

  • Brakeman security scan rake tasks are updated to use brakeman:run for consistency.

dependabot bot and others added 11 commits February 9, 2026 23:40
Bumps the npm_and_yarn group with 1 update in the / directory: [lodash](https://github.com/lodash/lodash).


Updates `lodash` from 4.17.21 to 4.17.23
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
- Updated loading overlay styles to ensure visibility during drag-and-drop actions.
- Modified methods to add loading overlays when moving entry cards, improving user feedback.
- Ensured smooth scrolling into view for entry cards after movement.

These changes enhance the user experience by providing immediate visual feedback during entry ranking updates.
…iler

- Introduced a new action `notify_completed` in JudgingRoundsController to notify contest contacts when judges complete their evaluations.
- Added `JudgeCompletedEvaluationsMailer` to handle the email notification logic, including dynamic subject and recipient handling.
- Implemented policy checks to ensure only authorized users can trigger the notification.
- Updated views to include a button for judges to notify contacts, which is enabled based on the number of entries ranked.
- Created corresponding tests to verify the functionality of the new action and mailer.

These enhancements improve communication with contest contacts and streamline the evaluation process for judges.
- Introduced a local variable `ranked_count` to store the count of ranked entries, improving readability.
- Updated the conditional message to use the new variable, maintaining clarity in user notifications.

These changes enhance code maintainability and ensure accurate messaging for judges during the ranking process.
…ements

- Added comprehensive tests for `addLoadingOverlay` and `removeLoadingOverlay` methods to ensure correct behavior and UI updates.
- Implemented per-element timeout management for slow connection warnings, allowing multiple overlays to clean up correctly.
- Improved error handling in the overlay removal process, including a visual indication of errors during updates.

These enhancements provide better user feedback and maintainability for the loading overlay functionality during entry ranking updates.
- Precomputed ranked entry counts and finalized statuses for each judging round to avoid N+1 query issues, enhancing performance.
- Updated the view to utilize precomputed data, improving readability and maintainability of the code.

These changes streamline data retrieval and improve the user experience on the judge dashboard.
- Updated the `update_rankings?`, `finalize_rankings?`, and `notify_completed?` methods to pass the user as an argument to `judging_open?`, improving the accuracy of access control.
- This change ensures that only authorized judges can update rankings or finalize them, enhancing security and clarity in the policy logic.

These modifications strengthen the policy checks for contest instances, ensuring proper authorization based on user context.
…yarn-f3562b46b9

Bump lodash from 4.17.21 to 4.17.23 in the npm_and_yarn group across 1 directory
- Updated the handling of single entry updates to accommodate both comment updates and unranking scenarios.
- Added conditions to manage cases where the rank is explicitly sent as blank, allowing for proper unranking of entries.
- Improved comment-only updates by ensuring existing rankings are updated without altering the rank.

These changes enhance the flexibility and clarity of the ranking process, ensuring accurate handling of entry updates.
- Introduced a new test suite for the `update_rankings` action to validate the unranking functionality when a single entry ranking is sent with a null rank.
- Ensured that the entry ranking is correctly removed from the database and that the response indicates success.
- This addition enhances test coverage for ranking updates, ensuring robust handling of entry rankings in various scenarios.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a “Notify Completed Evaluations” workflow for judges (UI button + controller action + mailer/templates), improves ranking/unranking UX with better loading overlays, and reduces judge-dashboard query overhead by precomputing ranked/finalized data.

Changes:

  • Add notify_completed judging-round action with mail delivery to the contest contact and corresponding UI button on the judge dashboard.
  • Improve ranking/unranking interactions (overlay handling, slow-connection warning, and unranking/comment-only update handling).
  • Reduce judge-dashboard N+1 queries via precomputed ranked counts and finalized state.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
yarn.lock Updates JS dependency lockfile (lodash).
spec/system/judge_dashboard_spec.rb Adds system coverage for the new “completed evaluations” button states and flow.
spec/policies/contest_instance_policy_spec.rb Removes ContestInstance policy specs.
spec/javascript/controllers/entry_drag_controller.spec.js Adds extensive overlay/timeout behavior tests for ranking UI.
spec/controllers/judging_rounds_controller_spec.rb Adds controller coverage for unranking and notify-completed behaviors.
lib/tasks/test.rake Updates Brakeman invocation to use brakeman:run.
config/routes.rb Adds notify_completed route under judging rounds.
app/views/judge_dashboard/index.html.erb Renders the new notify button and uses precomputed finalized state.
app/views/judge_completed_evaluations_mailer/notify_contact.text.erb Adds plaintext notification email template.
app/views/judge_completed_evaluations_mailer/notify_contact.html.erb Adds HTML notification email template.
app/policies/contest_instance_policy.rb Updates judging-open checks and adds notify_completed?.
app/mailers/judge_completed_evaluations_mailer.rb Introduces mailer for notifying contest contacts.
app/javascript/controllers/entry_drag_controller.js Improves overlay handling (per-element timeouts, overlay visibility on click actions).
app/controllers/judging_rounds_controller.rb Adds notify-completed action and refines ranking update behavior.
app/controllers/judge_dashboard_controller.rb Precomputes ranked counts and finalized round status to reduce queries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…dsController

- Eliminated the authorization call for the `notify_completed` method, streamlining the notification process for contest contacts.
- This change simplifies the controller logic, allowing for easier management of notifications without unnecessary authorization overhead.

These modifications enhance the functionality of the notification system within the judging rounds process.
…ionsMailer

- Implemented an ArgumentError raise when the contact_email is not provided, ensuring that the mailer fails gracefully with a clear message.
- This change enhances the robustness of the mailer by enforcing the requirement for a valid contact email before proceeding with notifications.

These modifications improve error handling and clarity in the email notification process for judges.
- Introduced a local variable `assigned_round_ids` to store the IDs of assigned rounds, improving code readability and reducing repeated calls to `pluck`.
- Updated queries for entry rankings and finalized statuses to utilize the new variable, enhancing performance by avoiding N+1 query issues.

These changes streamline data retrieval and improve the clarity of the Judge Dashboard logic.
…clarity and performance

- Simplified the ranking update process by consolidating logic for handling both ranking and unranking scenarios.
- Enhanced the response structure to provide clearer feedback on ranking updates, ensuring better user experience.
- These changes streamline the controller's functionality, making it easier to manage entry rankings while maintaining performance.
- Added jest.useFakeTimers() calls in multiple test cases to ensure accurate timing for overlay removal and error state display.
- This change improves the reliability of tests by simulating timer behavior, allowing for better validation of UI interactions in the EntryDragController.

These modifications enhance test coverage and ensure proper functionality of dynamic UI elements.
- Updated the logic for removing the loading overlay and the associated class to ensure that the class is only removed after the overlay is fully transitioned out. This prevents clipping during the transition and maintains proper styling.
- Introduced a new method, `removeOverlayAndClass`, to encapsulate the removal logic, enhancing code clarity and maintainability.

These changes improve the user experience by ensuring smoother transitions for loading states in the UI.
@rsmoke rsmoke merged commit 82c5d31 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.

2 participants