only submit one group assignment to turnitin

Fixes PS-356

test plan
* turnitin, non gorup assignments should still submit to turnitin as before
* turnitin, group assignments should only send the origianl submitters submission to turnitin

Change-Id: I29e90e9d42be8b57a9bc4755a4db9b0ffd9e0487
Reviewed-on: https://gerrit.instructure.com/21219
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Tyler Belnap <tyler@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
This commit is contained in:
Nathan Mills 2013-06-05 09:34:43 -06:00
parent 2708885166
commit 471d87ffba
2 changed files with 34 additions and 1 deletions

View File

@ -287,7 +287,7 @@ class Submission < ActiveRecord::Base
def prep_for_submitting_to_turnitin def prep_for_submitting_to_turnitin
last_attempt = self.turnitin_data && self.turnitin_data[:last_processed_attempt] last_attempt = self.turnitin_data && self.turnitin_data[:last_processed_attempt]
@submit_to_turnitin = false @submit_to_turnitin = false
if self.turnitinable? && (!last_attempt || last_attempt < self.attempt) if self.turnitinable? && (!last_attempt || last_attempt < self.attempt) && (@group_broadcast_submission || !self.group)
self.turnitin_data ||= {} self.turnitin_data ||= {}
if self.turnitin_data[:last_processed_attempt] != self.attempt if self.turnitin_data[:last_processed_attempt] != self.attempt
self.turnitin_data[:last_processed_attempt] = self.attempt self.turnitin_data[:last_processed_attempt] = self.attempt

View File

@ -506,6 +506,39 @@ describe Submission do
end end
end end
describe "group" do
before(:each) do
@teacher = User.create(:name => "some teacher")
@student = User.create(:name => "a student")
@student1 = User.create(:name => "student 1")
@context.enroll_teacher(@teacher)
@context.enroll_student(@student)
@context.enroll_student(@student1)
@a = assignment_model(:course => @context, :group_category => "Study Groups")
@a.submission_types = "online_upload,online_text_entry"
@a.turnitin_enabled = true
@a.save!
@group1 = @a.context.groups.create!(:name => "Study Group 1", :group_category => @a.group_category)
@group1.add_user(@student)
@group1.add_user(@student1)
end
it "should submit to turnitin for the original submitter" do
submission = @a.submit_homework @student, :submission_type => "online_text_entry", :body => "blah"
submissions = Submission.find_all_by_assignment_id @a.id
submissions.each do |s|
if s.id == submission.id
s.turnitin_data[:last_processed_attempt].should > 0
else
s.turnitin_data.should == nil
end
end
end
end
context "report" do context "report" do
before do before do
@assignment.submission_types = "online_upload,online_text_entry" @assignment.submission_types = "online_upload,online_text_entry"