speed up quizzes#show significantly for large quizzes
closes QO-613 test plan: * create and take a quiz * create a quiz and change the due dates per section or user * take that quiz too Change-Id: Ie5950053c14770bdae769afda2976e9563c367f4 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235558 Reviewed-by: Ethan Vizitei <evizitei@instructure.com> Product-Review: Ethan Vizitei <evizitei@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: KC Naegle <knaegle@instructure.com>
This commit is contained in:
parent
45aef70a90
commit
d82cfe6768
|
@ -258,8 +258,21 @@ module AssignmentOverrideApplicator
|
|||
# assignment_or_quiz all the time?
|
||||
def self.setup_overridden_clone(assignment, overrides = [])
|
||||
assignment.instance_variable_set(:@readonly_clone, true)
|
||||
|
||||
# avoid dup'ing quiz_data inside here, causing a very slow
|
||||
# serialize/deserialize cycle for a potentially very large blob. we (almost)
|
||||
# always overrwrite our quiz object with the overridden result anyway
|
||||
if assignment.is_a?(::Quizzes::Quiz)
|
||||
quiz_data = assignment.instance_variable_get(:@attributes)['quiz_data']
|
||||
assignment.quiz_data = nil
|
||||
end
|
||||
|
||||
clone = assignment.clone
|
||||
assignment.instance_variable_set(:@readonly_clone, false)
|
||||
if quiz_data
|
||||
assignment.instance_variable_get(:@attributes)['quiz_data'] = quiz_data
|
||||
clone.instance_variable_get(:@attributes)['quiz_data'] = quiz_data
|
||||
end
|
||||
|
||||
# ActiveRecord::Base#clone wipes out some important crap; put it back
|
||||
[:id, :updated_at, :created_at].each { |attr|
|
||||
|
|
Loading…
Reference in New Issue