show turnitin info for file upload submissions, fixes #6029

turnitin data wouldn't show up for file upload submissions in the
gradebook if there were over 100 assignments/students/submissions
(that's the threshold where we do ajax requests instead of just dumping
json on the page). fixed the json to be consistent.

test plan:
1. enable turnitin (or fake up some data)
2. do a file upload submission as a student
3. as the teacher, go into the gradebook
4. confirm that the turnitin icon shows up
5. add 100 students or assignments to the course (this will pass the
   threshold)
6. ensure the icon still shows in the gradebook

Change-Id: I164895b261e876dab7fb4a007c617552ae31de34
Reviewed-on: https://gerrit.instructure.com/9013
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Jon Jensen 2012-02-24 16:24:16 -07:00
parent 6e499fda0a
commit 742b5597de
2 changed files with 22 additions and 2 deletions

View File

@ -222,7 +222,7 @@ class GradebooksController < ApplicationController
else
@submissions = @context.submissions.scoped(scope_options)
end
render :json => @submissions
render :json => @submissions.to_json(:include => [:attachments, :quiz_submission, :submission_comments])
end
end
protected :gradebook_init_json

View File

@ -21,7 +21,8 @@ describe "gradebooks" do
:course => @course,
:name => 'first assignment',
:due_at => nil,
:points_possible => 10
:points_possible => 10,
:submission_types => 'online_text_entry,online_upload'
}
)
end
@ -73,4 +74,23 @@ describe "gradebooks" do
student_cell.should include_text @section1.display_name
student_cell.should include_text @section2.display_name
end
it "should show turnitin data" do
s1 = @assignment.submit_homework(@student1, :submission_type => 'online_text_entry', :body => 'asdf')
s1.update_attribute :turnitin_data, {"submission_#{s1.id}" => {:similarity_score => 0.0, :web_overlap => 0.0, :publication_overlap => 0.0, :student_overlap => 0.0, :state => 'none'}}
a = attachment_model(:context => @user, :content_type => 'text/plain')
s2 = @assignment.submit_homework(@student2, :submission_type => 'online_upload', :attachments => [a])
s2.update_attribute :turnitin_data, {"attachment_#{a.id}" => {:similarity_score => 1.0, :web_overlap => 5.0, :publication_overlap => 0.0, :student_overlap => 0.0, :state => 'acceptable'}}
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
ff('img.turnitin:visible').size.should eql 2
# now create a ton of students so that the data loads via ajax
100.times { |i| student_in_course(:active_all => true, :name => "other guy #{i}") }
get "/courses/#{@course.id}/gradebook"
wait_for_ajaximations
ff('img.turnitin:visible').size.should eql 2
end
end