Skip to content

Commit

Permalink
Fix spaces in option names throwing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Feb 20, 2024
1 parent bd55e97 commit fce71e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/models/forms/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ def options_to_xls(option_sets)
# node = the current option node
os.option_nodes.each do |node|
level_to_push = [] # array to be filled with parent levels if needed
listname_to_push = ""
listname_to_push = "" # name of the option set

if node.level.present?
# per XLSform style, option sets with levels need to have the
# list_name replaced with the level name to distinguish each row.
Expand All @@ -323,7 +324,11 @@ def options_to_xls(option_sets)

if node.option.present? # rubocop:disable Style/Next
option_row = []
option_row.push(listname_to_push, node.option.canonical_name, node.option.canonical_name)

# remove extra chars and spaces from choice name
choicename_to_push = vanillify(node.option.canonical_name)

option_row.push(listname_to_push, choicename_to_push, choicename_to_push)
option_row += level_to_push # append levels, if any, to rightmost columns
os_matrix.push(option_row)
end
Expand Down

0 comments on commit fce71e9

Please sign in to comment.