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

[75] Assign Evaluators to a Submission (WIP) #329

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from

Conversation

stonefilipczak
Copy link
Contributor

a mostly working WIP of assigning evaluators to a submission from the submission details page.

TODO:

  • implement unassign modal. The existing code for this always sends the user to a different page so I need to modify what's there to accept a return path or something along those lines.
  • styling mystery. The center bar of the hotdog gets pushed to the right when the "assigned evaluators" accordion is open. IDK why
  • tests

@r-bartlett-gsa r-bartlett-gsa added this to the Sprint 12/31/24 milestone Dec 20, 2024
@r-bartlett-gsa r-bartlett-gsa linked an issue Dec 20, 2024 that may be closed by this pull request
48 tasks
Copy link
Contributor

@stepchud stepchud left a comment

Choose a reason for hiding this comment

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

initial review feedback, there are some codeclimate issues also

.zshrc Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably remove this file, not sure why we need it?

@@ -1109,7 +1109,7 @@ CREATE TABLE public.submissions (
description_delta text,
brief_description_delta text,
pdf_reference character varying(255),
comments text
comments character varying
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed here

Comment on lines +24 to +26
def unassign

end
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unused, we can rely on the update route for unassigning

if @evaluator_submission_assignment.save
redirect_to submission_path(@submission), notice: I18n.t("evaluator_submission_assignment_saved")
else
redirect_to confirmation_evaluation_form_path(@evaluator_submission_assignment), notice: I18n.t("evaluation_form_saved")
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the wrong path to redirect to when it failed to save. it should probably redirect to the current evaluator_submission_assignment with a warning error message instead of evaluation_form_saved flash notice.

<% else %>
<%= render partial: 'assigned_evaluators' %>
<%= render partial: 'available_evaluators' %>
<% end %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget the link to "Manage my evaluation panel"
Screenshot 2024-12-20 at 12 01 33 PM

Comment on lines +34 to +37
<%= form_with url: phase_evaluator_submission_assignments_path(@submission.phase) do |f| %>
<%= f.hidden_field :evaluator_id, value: evaluator.id %>
<%= f.hidden_field :submission_id, value: @submission.id %>
<%= f.submit "Unassign" %>
Copy link
Contributor

Choose a reason for hiding this comment

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

this form routes to the create action when it should issue an update to the existing evaluator_submission_assignment to mark it unassigned if it's assigned and recused_unassigned if it is recused status.
assigned => unassigned
recused => recused_unassigned
because it creates a new evaluator_submission_assignment, that also creates duplicate assignment records. we should also validate uniqueness on the combination of evaluator_id/phase_id/submission_id in the EvaluatorSubmissionAssignment model, so we don't end up with duplicate records (just in case someone tries to create one).

</tr>
</thead>
<tbody>
<% @submission.evaluators.each do |evaluator| %>
Copy link
Contributor

Choose a reason for hiding this comment

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

we should filter this by evaluator_submission_assignments with assigned or recused status. (this should work, or you can assign the filtered list in the controller like you do with @available_evaluators)

Suggested change
<% @submission.evaluators.each do |evaluator| %>
<% @submission.evaluators.where("evaluator_submission_assignments.status" => ["assigned", "recused"]).each do |evaluator| %>

@@ -5,7 +5,9 @@ class SubmissionsController < ApplicationController
before_action -> { authorize_user('challenge_manager') }
before_action :set_submission, only: [:show, :update]

def show; end
def show
@available_evaluators = @submission.phase.evaluators - @submission.evaluators
Copy link
Contributor

Choose a reason for hiding this comment

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

this list needs a bit of tweaking to account for different statuses. available evaluators should include evaluators that were assigned and then unassigned. when you add specs we should test all these scenarios where the evaluators are in different states of assigned/unassigned/recused/recused_unassigned and make sure it's working for each case.

Copy link
Contributor

Choose a reason for hiding this comment

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

See this Figma comment thread.. if the evaluator was unassigned the button CTA should read "Reassign to Submission".

type="checkbox"
id="<%= "#{rand}-judging-status-selected" %>"
value="selected"
<%= "disabled" if @submission.judging_status == "winner" %>
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like #321 will merge first so I wanted to leave a reminder to update this disabled state from that logic once it's merged:

def eligibility_deselection_disabled?
evaluator_submission_assignments.exists?(status: [:assigned, :recused])
end
def advancement_checkbox_disabled?
!eligible_for_evaluation? || !all_evaluations_completed? || evaluators.empty?
end

(also the winner status disabled below)

@@ -9,4 +9,8 @@ def eligible_for_evaluation?(submission)
def selected_to_advance?(submission)
submission.judging_status.in?(%w[winner])
end

def available_evaluators(submission)
submission.phase.evaluators - submission.evaluators || []
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the || [] fallback right? [] - [] == []

Suggested change
submission.phase.evaluators - submission.evaluators || []
submission.phase.evaluators - submission.evaluators

@@ -0,0 +1 @@
export PHOENIX_URI="localhost:4000"
Copy link
Contributor

Choose a reason for hiding this comment

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

are you using nix? this value is defined in .env_dev so you can source that directly instead if you don't use nix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assign Evaluators to a Submission - Manual
3 participants