Skip to content

Commit

Permalink
Merge pull request #413 from DigitalCurationCentre/xsrust/bugfixes
Browse files Browse the repository at this point in the history
fixed logic which lead to guidance not being displayed
  • Loading branch information
vyruss authored Jun 12, 2017
2 parents 66a258d + d93092d commit c6a10f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/views/phases/_answer_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<%= hidden_field_tag :question_id, question.id, class: "question_id" %>
<ul class="question_right_column_ul">
<% annotations = question.annotations.where(type: Annotation.types[:guidance]) %>
<% if annotations.present? || question_guidances[question.id] %>
<% if annotations.present? || question_guidances.present? %>
<!-- add css to comment div-->
<% css_style_comment_div = "display: none;"%>
<% css_style_guidance_div = ""%>
Expand Down
26 changes: 7 additions & 19 deletions lib/tasks/migrate.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit c6a10f9

Please sign in to comment.