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

[179] View Evaluator's Submissions #258

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

Conversation

emmabjj
Copy link
Contributor

@emmabjj emmabjj commented Nov 7, 2024

Related tickets: #179, #76, #74

Add UI to view evaluators' submissions from the manage evaluator index page.

  • View Evaluator's Submissions #179
  • Allows a challenge manager to view the assigned and unassigned submissions of an evaluator for a particular phase. The different statuses for an evaluator's assigned submissions are either "recused", "in progress", "not started", or "completed".
  • A challenge manager will be able to see the total assigned challenge submissions, the evaluation's due date (the phase's end date), and the number of evaluations completed, in progress, and not started
  • For each assigned submission, a challenge manager will see the submission ID, the evaluation status, the evaluator's score (WIP), and an option to unassign or view an evaluation.
  • For each unassigned submission, a challenge manager will see the submission ID, the evaluation status (unassigned WIP), the evaluator's score (WIP), and an option to reassign the submission to the evaluator.

Add UI and functionality for the Unassign Evaluator from a Submission modal and add functionality to reassign a submission to an evaluator.

I've added controller tests - other tests WIP. The UI is responsive.

evaluator_submissions_view

Screenshot 2024-11-07 at 11 53 21 AM Screenshot 2024-11-07 at 11 53 53 AM

Mobile

Screenshot 2024-11-07 at 11 54 45 AM Screenshot 2024-11-07 at 11 54 56 AM Screenshot 2024-11-07 at 11 55 08 AM Screenshot 2024-11-07 at 11 55 19 AM

@emmabjj emmabjj self-assigned this Nov 7, 2024
@emmabjj emmabjj requested a review from stepchud November 7, 2024 20:32
config/routes.rb Outdated Show resolved Hide resolved
Base automatically changed from 200_manage_evaluators_list to dev November 20, 2024 00:27
@emmabjj emmabjj changed the title WIP - [179] View Evaluator's Submissions [179] View Evaluator's Submissions Nov 22, 2024
@emmabjj emmabjj marked this pull request as ready for review November 22, 2024 19:28
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 feedback on route and controller

config/routes.rb Outdated Show resolved Hide resolved
app/helpers/evaluators_helper.rb Outdated Show resolved Hide resolved
@stepchud stepchud dismissed their stale review November 26, 2024 23:04

feedback addressed

Comment on lines +22 to +25
assigned: 0,
unassigned: 1,
recused: 2,
not_started: 3,
Copy link
Contributor

Choose a reason for hiding this comment

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

how are assigned and not_started statuses different? I left a comment here about the status of the assignment/evaluation progress WRT not_started, in_progress and completed. here are some examples of queries that filter on those statuses (that PR isn't merged yet).

I think I'd prefer to stick with that approach for now because it is easier than keeping the status updated in all cases of progress. let me know if it doesn't make sense here.

end

def handle_successful_update(new_status)
flash.now[:success] = t("evaluator_submission_assignments.#{new_status}.success")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the flash.now[:success] should be flash[:success] since you are redirecting to the next page

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 tested this and I don't see the message unless it used flase[:success], unfortunately there is some rubocop linter warning about this but you should disable that cop for these line.

end

def handle_failed_update(new_status)
flash.now[:error] = t("evaluator_submission_assignments.#{new_status}.failure")
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, use flash[:error]

Comment on lines +61 to +62
const evaluatorId = new URLSearchParams(window.location.search).get('evaluator_id');
window.location.href = `/phases/${this.phaseIdValue}/evaluator_submission_assignments?evaluator_id=${evaluatorId}`;
Copy link
Contributor

@stepchud stepchud Nov 27, 2024

Choose a reason for hiding this comment

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

this is essentially doing location.reload() right? I have a different idea, what if you redirect to the path provided in the response data. you could render the url in the response JSNO as data.redirect_to or something and then reuse that same redirect path for both success and error since the backend will determine where to send the user. I think this will also display the flash message that was stored after the browser redirects, so you may not need the alert() either. if you want you can still log a console.error() for developer debugging help messages.

Suggested change
const evaluatorId = new URLSearchParams(window.location.search).get('evaluator_id');
window.location.href = `/phases/${this.phaseIdValue}/evaluator_submission_assignments?evaluator_id=${evaluatorId}`;
window.location.href = data.redirect_to;

'Accept': 'application/json'
},
body: JSON.stringify({
status: 'unassigned'
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried modifying this value to send some unknown, invalid status to the backend to trigger an error but it caused a 500 exception instead in the model update. You can remedy this by validating the status param in the rails controller before trying to update the model with an invalid value. if the client sends an invalid status, reject the request with :unprocessable_entity status.

Copy link
Contributor

Choose a reason for hiding this comment

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

.. alternatively you could rescue errors from the @assignment.update call in the controller to return false

Assigned Submissions
</h3>
<p class="usa-summary-box__text text-primary-darker text-bold">
Evaluations due by <%= @phase.end_date.strftime('%m/%d/%Y') %>
Copy link
Contributor

Choose a reason for hiding this comment

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

evaluations are due by the form's closing_date. there are a few other stats collection examples on #280, although there are subtle differences in the two components.

Suggested change
Evaluations due by <%= @phase.end_date.strftime('%m/%d/%Y') %>
Evaluations due by <%= @phase.evaluation_form.closing_date.strftime('%m/%d/%Y') %>

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 a little nitpicky, but can we rename this _assignments_stats.html.erb just for consistency with the other stats component on #280?

Copy link
Contributor

Choose a reason for hiding this comment

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

that's a cool use of layout 👍

Comment on lines +16 to +18
<%= render 'submission_summary', assigned_count: @assigned_submissions.count,
submissions_count: @submissions_count,
phase_end_date: @phase.end_date %>
Copy link
Contributor

Choose a reason for hiding this comment

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

these local assigns are unused and not needed

Suggested change
<%= render 'submission_summary', assigned_count: @assigned_submissions.count,
submissions_count: @submissions_count,
phase_end_date: @phase.end_date %>
<%= render 'submission_summary' %>

<tr data-evaluator-id="<%= evaluator.id %>" data-evaluator-type="user">
<td data-label="Submission ID" class="text-top text-bold"><%= assignment.submission.id %></td>
<td data-label="Evaluation status">
<span class="text-top text-bold <%= evaluation_status(assignment.status) %>"><%= assignment.status.titleize %></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

did you try using the uswds tag here (with color)?

<div class="margin-bottom-2 margin-top-3">
<%= link_to path, class: "usa-link display-inline-flex flex-align-center" do %>
<%= image_tag('images/usa-icons/arrow_back.svg', class: "usa-icon--size-3", alt: "Back to previous page") %>
<span class="margin-left-05 text-primary"><%= 'Back' %></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is 'Back' interpolated?

Suggested change
<span class="margin-left-05 text-primary"><%= 'Back' %></span>
<span class="margin-left-05 text-primary">Back</span>

Copy link
Contributor

Choose a reason for hiding this comment

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

let's add a request spec for the #index route here and also spec/system/evaluator_submission_assignment_spec.rb with a11y expect(page).to be_axe_clean and some page interactions assigning and unassigning evaluators with confirmation modal.

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.

View Evaluator's Submissions Unassign Evaluators from a Submission
3 participants