don't unnecesarily dirty rows

this data actually changes rarely, so don't force the row to be written
if it didn't change

Change-Id: I7876ab5488f8b0d810f032f20bc5a60c06447efd
Reviewed-on: https://gerrit.instructure.com/28995
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2014-01-21 13:25:57 -07:00
parent 7e99b7ed64
commit bded0a7a2a
1 changed files with 1 additions and 0 deletions

View File

@ -96,6 +96,7 @@ class DueDateCacher
# copy the results back to the submission table
submissions.
joins("INNER JOIN calculated_due_ats ON calculated_due_ats.submission_id=submissions.id").
where("cached_due_date<>calculated_due_ats.due_at OR (cached_due_date IS NULL)<>(calculated_due_ats.due_at IS NULL)").
update_all("cached_due_date=calculated_due_ats.due_at")
# clean up