diff --git a/app/views/phases/_answer_form.html.erb b/app/views/phases/_answer_form.html.erb
index 334c057219..dfa1d6c91b 100644
--- a/app/views/phases/_answer_form.html.erb
+++ b/app/views/phases/_answer_form.html.erb
@@ -36,7 +36,7 @@
<%= hidden_field_tag :question_id, question.id, class: "question_id" %>
<% annotations = question.annotations.where(type: Annotation.types[:guidance]) %>
- <% if annotations.present? || question_guidances[question.id] %>
+ <% if annotations.present? || question_guidances.present? %>
<% css_style_comment_div = "display: none;"%>
<% css_style_guidance_div = ""%>
diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake
index 0bd54fd22d..a686e8365a 100644
--- a/lib/tasks/migrate.rake
+++ b/lib/tasks/migrate.rake
@@ -14,6 +14,13 @@ namespace :migrate do
Rake::Task['migrate:seed'].execute
Rake::Task['migrate:permissions'].execute
end
+
+ desc "perform all post-migration tasks"
+ task cleanup: :environment do
+ Rake::Task['migrate:fix_languages'].execute
+ Rake::Task['migrate:single_published_template'].execute
+ end
+
desc "seed database with default values for new data structures"
task seed: :environment do
@@ -152,25 +159,6 @@ namespace :migrate do
end
- desc "enforces unique dmptemplate_id for templates"
- task unique_dmptemplate_id: :environment do
- Template.where('dmptemplate_id = customization_of').each do |temp|
- # iterate over all templates ____WITH POTENTIALLY BAD DATA ______
- same_dmptemp = Template.where(org_id: temp.org_id, customization_of: temp.customization_of).where('customization_of <> dmptemplate_id').first
- if same_dmptemp.present?
- temp.dmptemplate_id = same_dmptemp.dmptemplate_id
- # use that dmptemplate_id
- else
- # generate a new dmptemplate_id
- temp.dmptemplate_id = loop do
- random = rand 2147483647 # max int field in psql
- break random unless Template.exists?(dmptemplate_id: random)
- end
- end
- temp.save!
- end
- end
-
desc "replaces languages in incorrect formats and seeds all correct formats"
task fix_languages: :environment do
languages = [