diff --git a/app/controllers/phases_controller.rb b/app/controllers/phases_controller.rb index b9d9685..7e686fa 100644 --- a/app/controllers/phases_controller.rb +++ b/app/controllers/phases_controller.rb @@ -118,6 +118,11 @@ if params.has_key?(:question_id) @question_id = params[:question_id].to_i end + if @phase.template.customization_of.present? + @original_org = Template.where(dmptemplate_id: @phase.template.customization_of).first.org + else + @original_org = @phase.template.org + end end diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 817229d..742ce33 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -117,7 +117,7 @@ if section.modifiable # this is a custom section section_copy = Section.deep_copy(section) - customization_phase = new_customization.phases.includes(:sections.where(number: phase.number).first) + customization_phase = new_customization.phases.includes(:sections).where(number: phase.number).first section_copy.phase_id = customization_phase.id # custom sections get added to the end section_copy.number = customization_phase.sections.length + 1 diff --git a/app/views/questions/_show_question.html.erb b/app/views/questions/_show_question.html.erb index 43aa3d3..6e2be90 100644 --- a/app/views/questions/_show_question.html.erb +++ b/app/views/questions/_show_question.html.erb @@ -63,7 +63,7 @@ <% if !question.section.phase.template.org.funder? %> - <% example_answer = question.get_example_answer(current_user.org_id) %> + <% example_answer = question.get_example_answer(@original_org.id) %> <% if example_answer.present? && example_answer.text.present? %> @@ -74,7 +74,7 @@ <% end %> <% end %> - <% guidance = question.get_guidance_annotation(current_user.org_id) %> + <% guidance = question.get_guidance_annotation(@original_org.id) %> <% if guidance.present? %> <%= _('Guidance')%>