From c54670da94a56442ec2d4d07ce54d5811d400669 Mon Sep 17 00:00:00 2001 From: Brian Whitmer Date: Fri, 4 Feb 2011 14:12:36 -0700 Subject: [PATCH] update cached turnitin data when redirecting to originality report Turnitin has no way to register callbacks when a submission's originality score changes. However, teachers are able to modify originality scores for submissions by marking certain sources as being ignored when checking for originality. If a teacher does this then the data we've cached will get out of date. We don't really want to have to regularly poll for updated info, so this will just schedule a background job to check for updates whenever someone goes to view the full originality report. There will still be plenty of time when the data it out of sync, but it at least gives a way in the UI to update the data. Change-Id: Ia8cc814a2e9cf5ec140d3fd22acedfbb00da1b8a Reviewed-on: https://gerrit.instructure.com/2163 Tested-by: Hudson Reviewed-by: Bracken Mosbacker --- app/models/submission.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/submission.rb b/app/models/submission.rb index c9eedbd6b2c..3dde392baed 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -180,6 +180,7 @@ class Submission < ActiveRecord::Base def turnitin_report_url(asset_string, user) if self.turnitin_data && self.turnitin_data[asset_string] && self.turnitin_data[asset_string][:similarity_score] turnitin = Turnitin::Client.new(*self.context.turnitin_settings) + self.send_later(:check_turnitin_status, asset_string) if self.grants_right?(user, nil, :grade) turnitin.submissionReportUrl(self, asset_string) elsif self.current_submission_graded?