-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: dev
Are you sure you want to change the base?
Conversation
Co-authored-by: Stephen Chudleigh <[email protected]>
Co-authored-by: Stephen Chudleigh <[email protected]>
Co-authored-by: Stephen Chudleigh <[email protected]>
Co-authored-by: Stephen Chudleigh <[email protected]>
There was a problem hiding this 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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed here
def unassign | ||
|
||
end |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<%= 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" %> |
There was a problem hiding this comment.
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| %> |
There was a problem hiding this comment.
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)
<% @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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" %> |
There was a problem hiding this comment.
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:
Challenge_platform/app/models/submission.rb
Lines 78 to 84 in bde972d
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 || [] |
There was a problem hiding this comment.
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? [] - [] == []
submission.phase.evaluators - submission.evaluators || [] | |
submission.phase.evaluators - submission.evaluators |
@@ -0,0 +1 @@ | |||
export PHOENIX_URI="localhost:4000" |
There was a problem hiding this comment.
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
a mostly working WIP of assigning evaluators to a submission from the submission details page.
TODO: