Don't show incorrect peer review/rubric directions

For a peer-reviewed assignment with a rubric, don't show the message
indicating that you must both fill out the rubric and leave a comment,
since doing the former is sufficient. (For a peer-reviewed assignment
*without* a rubric, continue showing the corresponding message since
it's correct.)

fixes EVAL-1108
flag=none

Test plan:
- Create two assignments:
  - A1: Peer-review enabled, online submissions, no rubric
  - A2: Peer-review enabled, online submissions, attach a rubric
- Assign a student to peer-review another student for both assignments
- As each student, submit submit to each assignment
- As the assessing student:
  - Open the peer-review page for A1
    - You should see a message saying "This peer review is not finished
      yet." and enjoining you to leave a comment to finish it
    - Leave a comment and refresh the page
    - You should see "You have completed the required steps for this
      peer review"
  - Open the peer-review page for A2
    - You should not see a corresponding message
    - Fill out the rubric and refresh the page
    - You should see "You have completed the required steps for this
      peer review"

Change-Id: Ic26bfdfa98adf5d9226a7e5e201eb35fed02d8e7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267410
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kai Bjorkman <kbjorkman@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Jody Sailor
This commit is contained in:
Adrian Packel 2021-06-21 10:22:12 -05:00
parent 230033611d
commit 03562453a0
2 changed files with 56 additions and 8 deletions

View File

@ -232,14 +232,9 @@
<div class="assessment_request_completed_message" style="<%= hidden unless @assessment_request.completed? %>">
<%= t('peer_review_steps_complete', 'You have finished the required steps for this peer review.') %>
</div>
<div class="assessment_request_incomplete_message" style="<%= hidden if @assessment_request.completed? %>">
<% if @assessment_request && @assessment_request.active_rubric_association? %>
<%= mt('peer_review_not_done_rubric', "**This peer review is not finished yet.** For it to be considered finished, you need to leave at least one comment and fill out the rubric form to the right.")
%>
<% else %>
<%= mt('peer_review_not_done', "**This peer review is not finished yet.** For it to be considered finished, you need to leave at least one comment.")
%>
<% end %>
<% hide_assessment_instructions = @assessment_request.completed? || @assessment_request.active_rubric_association? %>
<div class="assessment_request_incomplete_message" style="<%= hidden if hide_assessment_instructions %>">
<%= mt('peer_review_not_done', "**This peer review is not finished yet.** For it to be considered finished, you need to leave at least one comment.") %>
</div>
<div>
</div>

View File

@ -567,6 +567,20 @@ describe "/submissions/show" do
expect(rubric_link_text).to match(/Show Rubric/)
end
it "shows a message when the request is complete" do
@assessment_request.complete!
view_context(@course, @student)
assign(:assignment, @assignment)
assign(:submission, @submission)
assign(:assessment_request, @assessment_request)
render 'submissions/show'
html = Nokogiri::HTML5.fragment(response.body)
completed_message = html.css('.assessment_request_completed_message')
expect(completed_message.attr('style').value).not_to match(/display:\s*none/)
end
it 'adds assessing class to rubric_container' do
view_context(@course, @student)
assign(:assignment, @assignment)
@ -580,6 +594,45 @@ describe "/submissions/show" do
end
end
context "when an assignment is peer-reviewed" do
let(:assignment) { @course.assignments.create!(peer_reviews: true) }
let(:student_to_assess) { @course.enroll_student(User.create!, enrollment_state: "active").user }
let(:submission) { assignment.submission_for_student(student_to_assess) }
let(:assessment_request) do
submission.assessment_requests.create!(
assessor: @student,
assessor_asset: assignment.submission_for_student(@student),
user: submission.user
)
end
before(:each) do
view_context(@course, @student)
assign(:assignment, assignment)
assign(:submission, submission)
assign(:assessment_request, assessment_request)
end
it "shows assessment instructions when the assignment does not have a rubric" do
render 'submissions/show'
html = Nokogiri::HTML5.fragment(response.body)
message_container = html.at_css('.assessment_request_incomplete_message')
expect(message_container.text).to include('This peer review is not finished yet.')
expect(message_container.attr('style')).not_to match(/display:\s*none/)
end
it "does not show assessment instructions when the assignment has a rubric" do
rubric_association = rubric_association_model(association_object: assignment, purpose: 'grading')
assessment_request.update!(rubric_association: rubric_association)
render 'submissions/show'
html = Nokogiri::HTML5.fragment(response.body)
message_container = html.at_css('.assessment_request_incomplete_message')
expect(message_container.attr('style')).to match(/display:\s*none/)
end
end
describe "media comments" do
let_once(:assignment) { @course.assignments.create! }
let_once(:student) { course_with_user("StudentEnrollment", course: @course, name: "Stu", active_all: true).user }