diff --git a/app/helpers/plans_helper.rb b/app/helpers/plans_helper.rb index a3db40d..d8d893b 100644 --- a/app/helpers/plans_helper.rb +++ b/app/helpers/plans_helper.rb @@ -48,9 +48,13 @@ return hash[:phases].many? ? "#{plan.title} - #{phase[:title]}" : plan.title end - def display_questions_and_section_headings(section, show_sections_questions, show_custom_sections) - # Return true if show_sections_questions is true and either section not customised, or section is customised - # and show_custom_sections is true - return show_sections_questions && (!section[:modifiable] || (show_custom_sections && section[:modifiable])) + def display_questions_and_section_headings(customization, section, show_sections_questions, show_custom_sections) + display = false + if show_sections_questions + display = !customization + display ||= customization && !section[:modifiable] + display ||= customization && section[:modifiable] && show_custom_sections + end + return display end end diff --git a/app/models/concerns/exportable_plan.rb b/app/models/concerns/exportable_plan.rb index dac15c3..94f3b58 100644 --- a/app/models/concerns/exportable_plan.rb +++ b/app/models/concerns/exportable_plan.rb @@ -75,7 +75,7 @@ .joins(phases: { sections: { questions: :question_format } }) .where(id: self.template_id) .order('sections.number', 'questions.number').first - + hash[:customization] = template.customization_of.present? hash[:title] = self.title hash[:answers] = self.answers diff --git a/app/views/shared/export/_plan.erb b/app/views/shared/export/_plan.erb index 43c7022..14051b6 100644 --- a/app/views/shared/export/_plan.erb +++ b/app/views/shared/export/_plan.erb @@ -24,7 +24,7 @@