diff --git a/app/models/survey_response.rb b/app/models/survey_response.rb index 9e5135b..7bb50de 100644 --- a/app/models/survey_response.rb +++ b/app/models/survey_response.rb @@ -109,7 +109,7 @@ def populate_experience_codes "notes" => notes_codes }.each do |context, codes| codes.each do |name| - code = Code.find_or_create_by(name: name, context: context) + code = Code.find_or_create_by(name: name, context: context) Experiences.create(from_node: persona, to_node: code) end end diff --git a/app/views/survey_responses/show.html.erb b/app/views/survey_responses/show.html.erb index 5ea9c35..3863087 100644 --- a/app/views/survey_responses/show.html.erb +++ b/app/views/survey_responses/show.html.erb @@ -54,9 +54,9 @@ <% counter += 1 %> <%= link_to question.label, question_path(question.key), class: "jump-link" %> - <%= @response.read_attribute(question.key) %> + <%= @response.read_attribute(question.key) || "(Not answered)" %> - <% if @response.respond_to?(question.key) && @response.read_attribute(question.key).present? %> + <% if @response.respond_to?(question.key) && @response.read_attribute(question.key).present? || @response.read_attribute(question.codes_field).any? %> <%= f.text_area question.codes_field, value: @response.read_attribute(question.codes_field).try(:sort).try(:join, ', '), multiple: true %> <%= f.submit "Save", class: "small" %> <% end %>