diff --git a/app/models/research_output.rb b/app/models/research_output.rb index 86484e7..1c0ec77 100644 --- a/app/models/research_output.rb +++ b/app/models/research_output.rb @@ -77,6 +77,10 @@ return false end + def get_answers_for_section(section_id) + self.answers.select { |answer| answer.question_id.in?(Section.find(section_id).questions.pluck(:id)) } + end + ## # deep copy the given research output # diff --git a/app/views/branded/shared/export/_export_by_question.erb b/app/views/branded/shared/export/_export_by_question.erb index 1ae2bbc..eadaade 100644 --- a/app/views/branded/shared/export/_export_by_question.erb +++ b/app/views/branded/shared/export/_export_by_question.erb @@ -11,26 +11,27 @@ <% options = answer.present? ? answer.question_options : [] %> <% unless @show_unanswered == false && blank %> - + <% if !@public_plan && @show_sections_questions && idx == 0 %>

<%# Hack: for DOCX export - otherwise, bold highlighting of question inconsistent. %> <% if local_assigns[:export_format] && export_format == 'docx' %> -

<%= sanitize question[:text].to_s, scrubber: TableFreeScrubber.new %>

+

<%= sanitize question[:text].to_s, scrubber: TableFreeScrubber.new %>

<% else %> -

<%= sanitize question[:text].to_s, scrubber: TableFreeScrubber.new %>

+

<%= sanitize question[:text].to_s, scrubber: TableFreeScrubber.new %>

<% end %>


<% end %> + <% if !section_has_common_answers %> +

<%= research_output.fullname %>

+ <% end %> + <%# case where question has not been answered sufficiently to display%> <% if @show_unanswered && (answer.blank? || (options.blank? && blank))%>

- <% if !section_has_common_answers %> - <%= research_output.fullname %> : - <% end %>
<%= _('Question not answered.') -%>

@@ -40,22 +41,16 @@ <%# case where Question has options %> <% if options.any? %> - <% if !section_has_common_answers %> - <%= research_output.fullname %> : - <% end %> -

+ <% end %> <%# case for RDA answer display %> <% if question[:format].rda_metadata? && !blank %> <% ah = answer.answer_hash %> <% if ah['standards'].present? %> - <% if !section_has_common_answers %> - <%= research_output.fullname %> : - <% end %>