Datafix for CNVS-32686
refs CNVS-32686 Change-Id: Ida8c19678020968b660f48789ce846243d36f4fd Reviewed-on: https://gerrit.instructure.com/93328 Reviewed-by: James Williams <jamesw@instructure.com> Tested-by: Jenkins QA-Review: Michael Hargiss <mhargiss@instructure.com> Product-Review: Davis Lynn McClellan <dmcclellan@instructure.com>
This commit is contained in:
parent
08127e8864
commit
540ca5374e
|
@ -0,0 +1,10 @@
|
|||
class FixDoubleYamlizedQuestionData < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::FixDoubleYamlizedQuestionData.send_later_if_production(:run)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
module DataFixup::FixDoubleYamlizedQuestionData
|
||||
QUERY = "left(question_data, 11) LIKE '--- |\n ---'"
|
||||
def self.run
|
||||
AssessmentQuestion.find_ids_in_ranges(:batch_size => 10000) do |min_id, max_id|
|
||||
AssessmentQuestion.where(:id => min_id..max_id).where(QUERY).find_each do |assessment_question|
|
||||
assessment_question.question_data = YAML.load(assessment_question.question_data)
|
||||
assessment_question.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue