Skip to content

Commit

Permalink
Merge pull request #54 from CoralineAda/fix-revenant-codes-at-last
Browse files Browse the repository at this point in the history
Show null survey response answers if there are associated codes
  • Loading branch information
CoralineAda authored Jun 26, 2024
2 parents 71b4a51 + a192504 commit 0d7a08a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/survey_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/survey_responses/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
<% counter += 1 %>
<tr class="<%= alt %>">
<td class="label"><%= link_to question.label, question_path(question.key), class: "jump-link" %></td>
<td class="response"><%= @response.read_attribute(question.key) %></td>
<td class="response"><%= @response.read_attribute(question.key) || "(Not answered)" %></td>
<td class="form-entry">
<% 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 %>
Expand Down

0 comments on commit 0d7a08a

Please sign in to comment.