Hide grade summary plagiarism info if anon
Do not show similarity scores on the grade summary page for assignments that are currently anonymizing students. fixes GRADE-1882 Test plan: - Have a course with at least one student - Create an anonymous assignment and a non-anonymous one with submission type text entry (to make life easier) - For a particular student: - Upload a text submission for each assignment - Create an OriginalityReport for each submission (see below) - Navigate to the grade summary page for that student/course - The non-anonymous assignment, as before, should show the plagiarism icon (which resembles some sort of sideways battlement and can be clicked on to bring up an originality report) on the right - The anonymous assignment should *not* show said icon - Unmute the anonymous assignment - The icon should now appear for that assignment To create an originality report: > submission.originality_reports.create!( originality_score: 75, # between 1 and 100 workflow_state: 'scored', originality_report_url: 'an-optional-custom-report-url-if-you-want' ) Change-Id: I9bfdab73b7c8012c76b29bee1554c9f83b1e4b43 Reviewed-on: https://gerrit.instructure.com/175906 Tested-by: Jenkins Reviewed-by: Jeremy Neander <jneander@instructure.com> Reviewed-by: Keith Garner <kgarner@instructure.com> QA-Review: James Butters <jbutters@instructure.com> Product-Review: Sidharth Oberoi <soberoi@instructure.com>
This commit is contained in:
parent
7101a0bd40
commit
3b7131f1be
|
@ -120,7 +120,7 @@ class GradeSummaryAssignmentPresenter
|
|||
assignment.special_class ? ("hard_coded " + assignment.special_class) : "editable"
|
||||
end
|
||||
|
||||
def show_submission_details_link?
|
||||
def show_submission_details?
|
||||
is_assignment? && !!submission&.can_view_details?(@current_user)
|
||||
end
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
<% if assignment_presenter.is_unread? %>
|
||||
<div class="unread-grade"> </div>
|
||||
<% end %>
|
||||
<% if assignment_presenter.show_submission_details_link? %>
|
||||
<% if assignment_presenter.show_submission_details? %>
|
||||
<a href="<%= context_url(@context, :context_assignment_submission_url, assignment, @presenter.student_id) %>"><%= assignment.title %></a>
|
||||
<% else %>
|
||||
<%= assignment.title %>
|
||||
|
@ -328,63 +328,65 @@
|
|||
</span>
|
||||
<i class="icon-rubric"></i>
|
||||
</a>
|
||||
<% if @presenter.turnitin_enabled? || assignment_presenter.originality_report? %>
|
||||
<%
|
||||
turntitin = nil
|
||||
url = '#'
|
||||
anchor_title = t('Similarity score -- more information')
|
||||
alt_text = t('See Turnitin results')
|
||||
tooltip_text = t('See Turnitin results')
|
||||
<% if assignment_presenter.show_submission_details? %>
|
||||
<% if @presenter.turnitin_enabled? || assignment_presenter.originality_report? %>
|
||||
<%
|
||||
turnitin = nil
|
||||
url = '#'
|
||||
anchor_title = t('Similarity score -- more information')
|
||||
alt_text = t('See Turnitin results')
|
||||
tooltip_text = t('See Turnitin results')
|
||||
|
||||
if can_do(submission, @current_user, :view_turnitin_report)
|
||||
turnitin = assignment_presenter.turnitin
|
||||
if assignment_presenter.is_text_entry? && !assignment_presenter.originality_report?
|
||||
url = context_url(@context, :context_assignment_submission_turnitin_report_url, assignment.id, @presenter.student_id, submission.asset_string)
|
||||
elsif assignment_presenter.originality_report? && turnitin
|
||||
asset_string = assignment_presenter.file&.asset_string || assignment_presenter.submission&.asset_string
|
||||
url = polymorphic_url([@context, assignment, submission, :originality_report], asset_string: asset_string)
|
||||
anchor_title = t('Originality Report')
|
||||
alt_text = t('Originality Report')
|
||||
tooltip_text = t('Originality Report')
|
||||
elsif assignment_presenter.is_online_upload? && assignment_presenter.file
|
||||
asset_string = assignment_presenter.file.asset_string
|
||||
url = context_url(@context, :context_assignment_submission_turnitin_report_url, assignment.id, @presenter.student_id, asset_string)
|
||||
if can_do(submission, @current_user, :view_turnitin_report)
|
||||
turnitin = assignment_presenter.turnitin
|
||||
if assignment_presenter.is_text_entry? && !assignment_presenter.originality_report?
|
||||
url = context_url(@context, :context_assignment_submission_turnitin_report_url, assignment.id, @presenter.student_id, submission.asset_string)
|
||||
elsif assignment_presenter.originality_report? && turnitin
|
||||
asset_string = assignment_presenter.file&.asset_string || assignment_presenter.submission&.asset_string
|
||||
url = polymorphic_url([@context, assignment, submission, :originality_report], asset_string: asset_string)
|
||||
anchor_title = t('Originality Report')
|
||||
alt_text = t('Originality Report')
|
||||
tooltip_text = t('Originality Report')
|
||||
elsif assignment_presenter.is_online_upload? && assignment_presenter.file
|
||||
asset_string = assignment_presenter.file.asset_string
|
||||
url = context_url(@context, :context_assignment_submission_turnitin_report_url, assignment.id, @presenter.student_id, asset_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
<% if url && url != '#' %>
|
||||
<a class="tooltip" title="<%= anchor_title %>" href="<%= url %>" style="<%= 'visibility: hidden;' if !turnitin %>" target="_blank">
|
||||
<%= turnitin ? image_tag("turnitin_#{turnitin && turnitin[:state]}_score.png", :alt => alt_text) : image_tag("blank.png", :alt => '') %>
|
||||
<span class="tooltip_wrap right">
|
||||
<span class="tooltip_text"><%= tooltip_text %></span>
|
||||
</span>
|
||||
</a>
|
||||
%>
|
||||
<% if url && url != '#' %>
|
||||
<a class="tooltip" title="<%= anchor_title %>" href="<%= url %>" style="<%= 'visibility: hidden;' if !turnitin %>" target="_blank">
|
||||
<%= turnitin ? image_tag("turnitin_#{turnitin && turnitin[:state]}_score.png", :alt => alt_text) : image_tag("blank.png", :alt => '') %>
|
||||
<span class="tooltip_wrap right">
|
||||
<span class="tooltip_text"><%= tooltip_text %></span>
|
||||
</span>
|
||||
</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @presenter.vericite_enabled? && !assignment_presenter.originality_report? %>
|
||||
<%
|
||||
vericite = nil
|
||||
url = '#'
|
||||
if submission && submission.can_view_plagiarism_report('vericite', @current_user, session)
|
||||
vericite = assignment_presenter.vericite
|
||||
if assignment_presenter.is_text_entry?
|
||||
url = context_url(@context, :context_assignment_submission_vericite_report_url, assignment.id, @presenter.student_id, submission.asset_string)
|
||||
elsif assignment_presenter.is_online_upload? && assignment_presenter.file
|
||||
asset_string = assignment_presenter.file.asset_string
|
||||
url = context_url(@context, :context_assignment_submission_vericite_report_url, assignment.id, @presenter.student_id, asset_string)
|
||||
<% if @presenter.vericite_enabled? && !assignment_presenter.originality_report? %>
|
||||
<%
|
||||
vericite = nil
|
||||
url = '#'
|
||||
if submission && submission.can_view_plagiarism_report('vericite', @current_user, session)
|
||||
vericite = assignment_presenter.vericite
|
||||
if assignment_presenter.is_text_entry?
|
||||
url = context_url(@context, :context_assignment_submission_vericite_report_url, assignment.id, @presenter.student_id, submission.asset_string)
|
||||
elsif assignment_presenter.is_online_upload? && assignment_presenter.file
|
||||
asset_string = assignment_presenter.file.asset_string
|
||||
url = context_url(@context, :context_assignment_submission_vericite_report_url, assignment.id, @presenter.student_id, asset_string)
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
%>
|
||||
|
||||
<span class="turnitin_score_container" style="<%= 'visibility: hidden;' if !vericite %>">
|
||||
<span class="vericite_score_container_caret <%= vericite && vericite[:state] %>_score"></span>
|
||||
<a title="<%= t('titles.vericite_score', "VeriCite similarity score -- more information") %>" href="<%= url %>" target="_blank" class="tooltip not_external turnitin_similarity_score <%= vericite && vericite[:state] %>_score">
|
||||
<%= vericite && vericite[:similarity_score] %>%
|
||||
<span class="tooltip_wrap right">
|
||||
<span class="tooltip_text"><%= t(:see_vericite_results, "See VeriCite results") %></span>
|
||||
</span>
|
||||
</a>
|
||||
</span>
|
||||
<span class="turnitin_score_container" style="<%= 'visibility: hidden;' if !vericite %>">
|
||||
<span class="vericite_score_container_caret <%= vericite && vericite[:state] %>_score"></span>
|
||||
<a title="<%= t('titles.vericite_score', "VeriCite similarity score -- more information") %>" href="<%= url %>" target="_blank" class="tooltip not_external turnitin_similarity_score <%= vericite && vericite[:state] %>_score">
|
||||
<%= vericite && vericite[:similarity_score] %>%
|
||||
<span class="tooltip_wrap right">
|
||||
<span class="tooltip_text"><%= t(:see_vericite_results, "See VeriCite results") %></span>
|
||||
</span>
|
||||
</a>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
|
|
@ -189,7 +189,7 @@ describe GradeSummaryAssignmentPresenter do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#show_submission_details_link?" do
|
||||
describe "#show_submission_details?" do
|
||||
before :each do
|
||||
@submission_stub = double()
|
||||
allow(@submission_stub).to receive(:originality_reports_for_display)
|
||||
|
@ -199,24 +199,24 @@ describe GradeSummaryAssignmentPresenter do
|
|||
@assignment = {}
|
||||
allow(@submission_stub).to receive(:can_view_details?).and_return(true)
|
||||
presenter = GradeSummaryAssignmentPresenter.new(summary, @student, @assignment, @submission_stub)
|
||||
expect(presenter.show_submission_details_link?).to be false
|
||||
expect(presenter.show_submission_details?).to be false
|
||||
end
|
||||
|
||||
it "returns false when assignment is an assignment and user cannot view details on submission" do
|
||||
allow(@submission_stub).to receive(:can_view_details?).and_return(false)
|
||||
presenter = GradeSummaryAssignmentPresenter.new(summary, @student, @assignment, @submission_stub)
|
||||
expect(presenter.show_submission_details_link?).to be false
|
||||
expect(presenter.show_submission_details?).to be false
|
||||
end
|
||||
|
||||
it "returns true when assignment is an assignment and use can view details on submission" do
|
||||
allow(@submission_stub).to receive(:can_view_details?).and_return(true)
|
||||
presenter = GradeSummaryAssignmentPresenter.new(summary, @student, @assignment, @submission_stub)
|
||||
expect(presenter.show_submission_details_link?).to be true
|
||||
expect(presenter.show_submission_details?).to be true
|
||||
end
|
||||
|
||||
it "returns false when submission is nil" do
|
||||
presenter = GradeSummaryAssignmentPresenter.new(summary, @student, @assignment, nil)
|
||||
expect(presenter.show_submission_details_link?).to be false
|
||||
expect(presenter.show_submission_details?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -135,4 +135,123 @@ describe "/gradebooks/grade_summary" do
|
|||
expect(response).to have_tag("a[href='#{@submission_details_url}']")
|
||||
end
|
||||
end
|
||||
|
||||
describe "plagiarism info" do
|
||||
let(:course) { Course.create! }
|
||||
let(:student) { course.enroll_student(User.create!, active_all: true).user }
|
||||
let(:teacher) { course.enroll_teacher(User.create!, active_all: true).user }
|
||||
|
||||
let(:assignment) do
|
||||
course.assignments.create!(
|
||||
title: 'hi',
|
||||
submission_types: 'online_text_entry',
|
||||
anonymous_grading: true
|
||||
)
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
assignment.submit_homework(student, submission_type: 'online_text_entry', body: 'hello')
|
||||
assign(:context, course)
|
||||
end
|
||||
|
||||
context "for an anonymous assignment viewed by a teacher" do
|
||||
let(:presenter) { GradeSummaryPresenter.new(course, teacher, student.id) }
|
||||
|
||||
before(:each) do
|
||||
assign(:presenter, presenter)
|
||||
assign(:current_user, teacher)
|
||||
end
|
||||
|
||||
context "when the assignment uses Turnitin" do
|
||||
before(:each) do
|
||||
allow(presenter).to receive(:turnitin_enabled?).and_return(true)
|
||||
end
|
||||
|
||||
it "does not show plagiarism info when students are anonymized" do
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).not_to have_tag("a[@title='Similarity score -- more information']")
|
||||
end
|
||||
|
||||
it "shows plagiarism info when students are not anonymized" do
|
||||
assignment.unmute!
|
||||
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).to have_tag("a[@title='Similarity score -- more information']")
|
||||
end
|
||||
end
|
||||
|
||||
context "when the submission has an associated originality report" do
|
||||
before(:each) do
|
||||
assignment.submission_for_student(student).originality_reports.create!(
|
||||
workflow_state: 'scored',
|
||||
originality_score: 88
|
||||
)
|
||||
end
|
||||
|
||||
it "does not show plagiarism info when students are anonymized" do
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).not_to have_tag("a[@title='Originality Report']")
|
||||
end
|
||||
|
||||
it "shows plagiarism info when students are not anonymized" do
|
||||
assignment.unmute!
|
||||
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).to have_tag("a[@title='Originality Report']")
|
||||
end
|
||||
end
|
||||
|
||||
context "when the assignment uses Vericite" do
|
||||
before(:each) do
|
||||
allow(presenter).to receive(:vericite_enabled?).and_return(true)
|
||||
end
|
||||
|
||||
it "does not show plagiarism info when students are anonymized" do
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).not_to have_tag("a[@title='VeriCite similarity score -- more information']")
|
||||
end
|
||||
|
||||
it "shows plagiarism info when students are not anonymized" do
|
||||
assignment.unmute!
|
||||
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).to have_tag("a[@title='VeriCite similarity score -- more information']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "for an anonymized assignment viewed by a site administrator" do
|
||||
let(:site_admin) { site_admin_user }
|
||||
let(:presenter) { GradeSummaryPresenter.new(course, site_admin, student.id) }
|
||||
|
||||
before(:each) do
|
||||
assign(:presenter, presenter)
|
||||
assign(:current_user, site_admin)
|
||||
end
|
||||
|
||||
it "always shows plagiarism info when the assignment uses Turnitin" do
|
||||
allow(presenter).to receive(:turnitin_enabled?).and_return(true)
|
||||
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).to have_tag("a[@title='Similarity score -- more information']")
|
||||
end
|
||||
|
||||
it "always shows plagiarism info when the submission has an originality report" do
|
||||
assignment.submission_for_student(student).originality_reports.create!(
|
||||
workflow_state: 'scored',
|
||||
originality_score: 88
|
||||
)
|
||||
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).to have_tag("a[@title='Originality Report']")
|
||||
end
|
||||
|
||||
it "always shows plagiarism info when the assignment uses Vericite" do
|
||||
allow(presenter).to receive(:vericite_enabled?).and_return(true)
|
||||
|
||||
render "gradebooks/grade_summary"
|
||||
expect(response).to have_tag("a[@title='VeriCite similarity score -- more information']")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue