Open StCyr opened 9 months ago
Variable blank
is created on line https://github.com/DMPRoadmap/roadmap/blob/main/app/views/shared/export/_plan.erb#L40,
but within an "if" statement. If that statement isn't executed, that variable does not exist, and
what is worse: variable answer
does not exist.
Better move these lines :
<div class="question">
+ <% answer = @plan.answer(question[:id], false) %>
+ <% blank = answer.present? ? answer.blank? : true %>
<% if @show_sections_questions%>
- <% answer = @plan.answer(question[:id], false) %>
- <% blank = answer.present? ? answer.blank? : true %>
Please complete the following fields as applicable:
What version of the DMPRoadmap code are you running? (e.g. v2.2.0)
v4.1.0
Expected behaviour:
roadmap shouldn't crash when I export a plan to pdf
Actual behaviour:
getting something went wrong when exporting a particular plan to pdf
Steps to reproduce:
given the following plan:
plan_65686_phase_5714_20230920T095452Z.pdf
If I try to download it in pdf format with no Optional plan components checked, or only the "unanswered questions" component checked:
Roadmap crashes with the infamous "something went wrong" message, and, in the logs, I can find this:
possible fix:
I believe the following code change fixes the issue properly: