diff --git a/app/views/plans/export.pdf.erb b/app/views/plans/export.pdf.erb index 8ac7827..b9ab084 100644 --- a/app/views/plans/export.pdf.erb +++ b/app/views/plans/export.pdf.erb @@ -29,38 +29,39 @@ <% end %> <% @exported_plan.sections.each do |section| %> -

<%= section.title %>

- <% questions = @exported_plan.questions_for_section(section.id) %> - <% questions.each_with_index do |question, idx| %> -
- <% unless idx == 0 && question.text == section.title %> + <% questions = @exported_plan.questions_for_section(section.id) + if questions.present? + %> +

<%= section.title %>

+ <% questions.each do |question| %> +

<%= raw question.text %>

- <% end %> - <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? then %> -

<%= _('Question not answered.') -%>

- <% else %> - <% q_format = question.question_format %> - <% if q_format.option_based? %> - - - <% if question.option_comment_display == true then%> + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? then %> +

<%= _('Question not answered.') -%>

+ <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> + + + <% if question.option_comment_display == true then%> + <% if !answer.text.nil? then %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <%end%> + <%end%> + <%else%> + <% if !answer.text.nil? then %> <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> <%end%> - <%end%> - <%else%> - - <% if !answer.text.nil? then %> - <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> - <%end%> - <% end %> - <% end %> -
+ <% end %> + <% end %> +
+ <% end %> <% end %> <% end %>