Skip to content

Commit

Permalink
Fix relevant column not correctly displaying the value of a selected …
Browse files Browse the repository at this point in the history
…option set
  • Loading branch information
Alex committed Apr 2, 2024
1 parent 969ead7 commit 0e3818c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/forms/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,13 @@ def conditions_to_xls(conditions, true_if)
left_to_push = "${#{left_qing.code}}"

# prep right side of expression
if dc.right_side_is_qing?
# operation will vary based on what we are comparing to
if dc.right_side_is_qing? # it's another question's value
right_qing = Questioning.find(dc.right_qing_id)
right_to_push = "${#{right_qing.code}}"
elsif dc.option_node_id.present? # it's an option set choice
right_node_value = OptionNode.find(dc.option_node_id).option.canonical_name
right_to_push = "'#{right_node_value}'"
elsif Float(dc.value, exception: false).nil? # it's not a number
# to respect XLSform rules, surround with single quotes unless it's a number
right_to_push = "'#{dc.value}'"
Expand Down

0 comments on commit 0e3818c

Please sign in to comment.