override cached_due_date with latest for versioned submissions
fixes CNVS-6869 reverts g/22303 and g/22305 Test Plan: - make a submission - change the due date on the submission's assignment - the speedgrader should incorporate the change and be able to tell if the submission is overdue based on the new due date Change-Id: I2604e0bde43a1f5970ee3a38813295be410f2212 Reviewed-on: https://gerrit.instructure.com/22480 Reviewed-by: Jacob Fugal <jacob@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Clare Strong <clare@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com> Product-Review: Duane Johnson <duane@instructure.com>
This commit is contained in:
parent
1c297e632b
commit
cd14156ad7
|
@ -1124,7 +1124,6 @@ class Assignment < ActiveRecord::Base
|
|||
)
|
||||
if json['submission_history']
|
||||
json['submission_history'].map! do |version|
|
||||
version.cached_due_date = sub.cached_due_date
|
||||
version.as_json(
|
||||
:include => {
|
||||
:submission_comments => { :only => comment_fields }
|
||||
|
|
|
@ -141,7 +141,8 @@ class Submission < ActiveRecord::Base
|
|||
|
||||
simply_versioned :explicit => true,
|
||||
:when => lambda{ |model| model.new_version_needed? },
|
||||
:on_create => lambda{ |model,version| SubmissionVersion.index_version(version) }
|
||||
:on_create => lambda{ |model,version| SubmissionVersion.index_version(version) },
|
||||
:on_load => lambda{ |model,version| model.cached_due_date = version.versionable.cached_due_date }
|
||||
|
||||
def new_version_needed?
|
||||
turnitin_data_changed? || (changes.keys - [
|
||||
|
|
|
@ -30,9 +30,7 @@ module Api::V1
|
|||
student = opts[:student] || submission.user
|
||||
current_grader = submission.grader || default_grader
|
||||
|
||||
model = version.model
|
||||
model.cached_due_date = submission.cached_due_date
|
||||
json = submission_attempt_json(model, assignment, api_context.user, api_context.session, nil, course).with_indifferent_access
|
||||
json = submission_attempt_json(version.model, assignment, api_context.user, api_context.session, nil, course).with_indifferent_access
|
||||
grader = (json[:grader_id] && json[:grader_id] > 0 && user_cache[json[:grader_id]]) || default_grader
|
||||
|
||||
json = json.merge(
|
||||
|
|
|
@ -31,7 +31,6 @@ module Api::V1::Submission
|
|||
if includes.include?("submission_history")
|
||||
hash['submission_history'] = []
|
||||
submission.submission_history.each_with_index do |ver, idx|
|
||||
ver.cached_due_date = submission.cached_due_date
|
||||
hash['submission_history'] << submission_attempt_json(ver, assignment, user, session, idx, context)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue