diff --git a/db/migrate/20161122152339_new_plan_template_structure.rb b/db/migrate/20161122152339_new_plan_template_structure.rb index 661ac12..fa94f85 100644 --- a/db/migrate/20161122152339_new_plan_template_structure.rb +++ b/db/migrate/20161122152339_new_plan_template_structure.rb @@ -199,7 +199,12 @@ sections += Section.where(organisation_id: project.organisation_id, version_id: version.id).pluck(:id) end Section.includes(questions: [:themes, :options, :suggested_answers]).where(id: sections).each do |section| - new_section = initNewSection(section, new_phase, modifiable) + if project.organisation_id.nil? + sec_mod = modifiable + else + sec_mod = (section.organisation_id == project.organisation_id) + end + new_section = initNewSection(section, new_phase, sec_mod) new_section.save! section.questions.each do |question| new_question = initNewQuestion(question, new_section, modifiable)