Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove submissions with more than 4 recusals #5403

Open
wants to merge 9 commits into
base: preview
Choose a base branch
from

Conversation

viviancan
Copy link
Contributor

@viviancan viviancan commented Feb 25, 2025

Refs #5335 and #5336

This PR adds functionality to automatically remove a submission from the judging pool on the 5th recusal.

Key Changes:

  • Added a new remove_from_judging_pool boolean field to team_submissions
  • Updated the logic to set remove_from_judging_pool to true when judge_recusal_count exceeds 4 recusals
  • Added scopes
  • Updated eligible submissions so that only submissions that are not removed from the judging pool are eligible for judging
  • Added a "removed submissions" partial on the scores page (similar to suspicious scores)
  • Added removed from judging filter & column to scored submissions datagrid
  • Added tests

@viviancan viviancan force-pushed the 5335-remove-submissions-with-more-than-5-recusals branch from 50e3cf1 to dc57def Compare February 25, 2025 18:37
@@ -7,7 +7,7 @@ class ScoredSubmissionsGrid

scope do
TeamSubmission.complete.current
.includes(:team, {submission_scores: :judge_profile})
.includes(team: :division, submission_scores: :judge_profile)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed bullet warning

@viviancan viviancan marked this pull request as ready for review February 26, 2025 16:21
@viviancan viviancan force-pushed the 5335-remove-submissions-with-more-than-5-recusals branch from ed3d453 to 8e4246a Compare February 27, 2025 03:37
@viviancan viviancan changed the title WIP Remove submissions with more than 5 recusals Remove submissions with more than 4 recusals Feb 27, 2025
@@ -128,6 +128,9 @@ def developed_on?(platform_name)
scope :complete, -> { where("published_at IS NOT NULL") }
scope :incomplete, -> { where("published_at IS NULL") }

scope :removed_from_judging_pool, -> { where(removed_from_judging_pool: true) }
scope :not_removed_from_judging_pool, -> { where(removed_from_judging_pool: false) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unsure of the scope names. I think removed_from_judging_pool is pretty straight forward but I'm wondering if the other should be eligble_for_judging or something more general like that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I like where you're headed, eligible_for_judging or something like that. 👍 And I could even see that scope containing complete too, as in an eligible submission for judging is a complete submission that hasn't been removed from the judging pool.

@@ -10,6 +10,7 @@ class ScoresController < AdminController
unless request.xhr?
@round = grid_params[:round]
end
@removed_submissions = TeamSubmission.current.complete.removed_from_judging_pool
Copy link
Contributor

Choose a reason for hiding this comment

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

Reading removed_submissions this seems to be a little vague to me, suggestion: submissions_removed_from_judging_pool or something more descriptive.

@@ -84,6 +84,10 @@ class ScoredSubmissionsGrid

column :judge_recusal_count, header: "Recusals", mandatory: true, order: true

column :removed_from_judging_pool, header: "Removed from judging pool", mandatory: true do |submission|
ApplicationController.helpers.humanize_boolean(submission.removed_from_judging_pool)
Copy link
Contributor

Choose a reason for hiding this comment

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

Using removed_from_judging_pool? would be more explicit that this returns a boolean (by convention); and since we're using a humanize_boolean helper vs the method w/o the ? (which will do the same thing, just doesn't follow the ? convention).

@@ -565,4 +567,8 @@ def pending_approval?
def update_team_score_summaries
team_submission.update_score_summaries
end

def update_removed_from_judging_pool
team_submission.reload.update(removed_from_judging_pool: team_submission.judge_recusal_count > 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if making this more explicit would make it easier to parse:

if recusal count >= 5
remove from judging pool

The basic format being:

  • if this, set that

vs.

  • set this to result of conditional

Just a random thought. 🙂

Copy link
Contributor

@shaun-technovation shaun-technovation left a comment

Choose a reason for hiding this comment

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

LGTM, some nice functionality here! 💯 :shipit:

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