allow students who are also account admins to peer review
fixes CNVS-18317 test plan: - create an account admin, and a course - enroll the account admin as a student in the course, along with other normal students - create a peer review assignment - submit as the admin, student A and student B - assign both the admin and student A to peer review student B - complete the peer review as student A first - then complete the peer review as the admin - it should work Change-Id: Id89ca9fd06e0e113156083d3bec031bd64fb394e Reviewed-on: https://gerrit.instructure.com/48387 Tested-by: Jenkins Reviewed-by: Mike Nomitch <mnomitch@instructure.com> QA-Review: Derek Hansen <dhansen@instructure.com> Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
parent
f62bb4fd5d
commit
b4a1230539
|
@ -131,7 +131,7 @@ class SubmissionsController < ApplicationController
|
||||||
@visible_rubric_assessments = @submission.rubric_assessments.select{|a| a.grants_right?(@current_user, session, :read)}.sort_by{|a| [a.assessment_type == 'grading' ? CanvasSort::First : CanvasSort::Last, Canvas::ICU.collation_key(a.assessor_name)] }
|
@visible_rubric_assessments = @submission.rubric_assessments.select{|a| a.grants_right?(@current_user, session, :read)}.sort_by{|a| [a.assessment_type == 'grading' ? CanvasSort::First : CanvasSort::Last, Canvas::ICU.collation_key(a.assessor_name)] }
|
||||||
end
|
end
|
||||||
|
|
||||||
@assessment_request = @submission.assessment_requests.where(assessor_id: @current_user).first rescue nil
|
@assessment_request = @submission.assessment_requests.where(assessor_id: @current_user).first
|
||||||
if authorized_action(@submission, @current_user, :read)
|
if authorized_action(@submission, @current_user, :read)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
json_handled = false
|
json_handled = false
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<%
|
<%
|
||||||
|
currently_peer_reviewing = @assessment_request.try(:assigned?)
|
||||||
js_bundle :rubric_assessment, :submissions
|
js_bundle :rubric_assessment, :submissions
|
||||||
js_env({
|
js_env({
|
||||||
:RUBRIC_ASSESSMENT => {
|
:RUBRIC_ASSESSMENT => {
|
||||||
:assessment_user_id => @submission.user_id,
|
:assessment_user_id => @submission.user_id,
|
||||||
:assessor_id => @current_user ? @current_user.id : "null",
|
:assessor_id => @current_user ? @current_user.id : "null",
|
||||||
:assessment_type => can_do(@submission, @current_user, :grade) ? "grading" : "peer_review"
|
:assessment_type => (!currently_peer_reviewing && can_do(@submission, @current_user, :grade)) ? "grading" : "peer_review"
|
||||||
},
|
},
|
||||||
|
|
||||||
:SUBMISSION => {
|
:SUBMISSION => {
|
||||||
|
@ -133,7 +134,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div style="display: none;">
|
<div style="display: none;">
|
||||||
<% if can_do(@context, @current_user, :manage_grades) %>
|
<% if !currently_peer_reviewing && can_do(@context, @current_user, :manage_grades) %>
|
||||||
<a style="display: none;" title="POST" href="<%= context_url(@context, :update_submission_context_gradebook_url) %>" class="update_submission_url"> </a>
|
<a style="display: none;" title="POST" href="<%= context_url(@context, :update_submission_context_gradebook_url) %>" class="update_submission_url"> </a>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a style="display: none;" title="PUT" href="<%= context_url(@context, :context_assignment_submission_url, @submission.assignment_id, @submission.user_id) %>" class="update_submission_url"> </a>
|
<a style="display: none;" title="PUT" href="<%= context_url(@context, :context_assignment_submission_url, @submission.assignment_id, @submission.user_id) %>" class="update_submission_url"> </a>
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
def rubric_association_model(opts={})
|
def rubric_association_model(opts={})
|
||||||
course_model(:reusable => true) unless @course || opts[:context]
|
course_model(:reusable => true) unless @course || opts[:context]
|
||||||
@rubric = opts[:rubric] || rubric_model(:context => opts[:context] || @course)
|
@rubric = opts[:rubric] || rubric_model(:context => opts[:context] || @course)
|
||||||
@rubric_association_object = @course.assignments.first || @course.assignments.create!(assignment_valid_attributes)
|
@rubric_association_object = opts[:association_object] ||
|
||||||
@rubric_association = @rubric.rubric_associations.create!(valid_rubric_assessment_attributes.merge(:association_object => opts[:association_object] || @rubric_association_object, :context => opts[:context] || @course, :purpose => opts[:purpose] || "none"))
|
@course.assignments.first ||
|
||||||
|
@course.assignments.create!(assignment_valid_attributes)
|
||||||
|
@rubric_association = @rubric.rubric_associations.create!(valid_rubric_assessment_attributes.merge(:association_object => @rubric_association_object, :context => opts[:context] || @course, :purpose => opts[:purpose] || "none"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_rubric_assessment_attributes
|
def valid_rubric_assessment_attributes
|
||||||
|
|
|
@ -28,5 +28,31 @@ describe "assignments" do
|
||||||
expect(fj('.student_reviews:first .peer_reviews').text()).to match /None Assigned/
|
expect(fj('.student_reviews:first .peer_reviews').text()).to match /None Assigned/
|
||||||
expect(@assignment.submissions.map(&:assessment_requests).flatten.length).to eq 1
|
expect(@assignment.submissions.map(&:assessment_requests).flatten.length).to eq 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "allows an account admin who is also a student to submit a peer review" do
|
||||||
|
course(active_course: true)
|
||||||
|
admin_logged_in(account: @course.root_account)
|
||||||
|
student_in_course(user: @admin)
|
||||||
|
@student = student_in_course.user
|
||||||
|
|
||||||
|
@assignment = assignment_model({
|
||||||
|
course: @course,
|
||||||
|
peer_reviews: true,
|
||||||
|
automatic_peer_reviews: false,
|
||||||
|
})
|
||||||
|
rubric_association_model(purpose: 'grading', association_object: @assignment)
|
||||||
|
@assignment.assign_peer_review(@admin, @student)
|
||||||
|
|
||||||
|
get "/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@student.id}"
|
||||||
|
|
||||||
|
f('.assess_submission_link').click
|
||||||
|
wait_for_animations
|
||||||
|
f('.rubric_table .criterion .rating').click
|
||||||
|
f('.save_rubric_button').click
|
||||||
|
wait_for_ajaximations
|
||||||
|
|
||||||
|
assessment = @assignment.submissions.where(user_id: @student).first.rubric_assessments.first
|
||||||
|
expect(assessment.assessment_type).to eq 'peer_review'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue