From 8aa219433b55d1950018b66fdccb9828e0867090 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 26 Mar 2024 19:26:03 +0200 Subject: [PATCH] render blank option checkbox --- app/views/submissions/_value.html.erb | 3 ++- lib/submissions/generate_result_attachments.rb | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/submissions/_value.html.erb b/app/views/submissions/_value.html.erb index 156bfcbb..d65e3db1 100644 --- a/app/views/submissions/_value.html.erb +++ b/app/views/submissions/_value.html.erb @@ -18,7 +18,8 @@ <% elsif field['type'].in?(%w[multiple radio]) && area['option_uuid'] %> <% option = field['options']&.find { |o| o['uuid'] == area['option_uuid'] } %> - <% if option && Array.wrap(value).include?(option['value']) %> + <% option_name = option['value'].presence || "Option #{field['options'].index(option) + 1}" %> + <% if option && Array.wrap(value).include?(option_name) %>
<%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %>
diff --git a/lib/submissions/generate_result_attachments.rb b/lib/submissions/generate_result_attachments.rb index 3b58a616..10b0bf1c 100644 --- a/lib/submissions/generate_result_attachments.rb +++ b/lib/submissions/generate_result_attachments.rb @@ -159,7 +159,9 @@ module Submissions if field['type'].in?(%w[multiple radio]) option = field['options']&.find { |o| o['uuid'] == area['option_uuid'] } - value = Array.wrap(value).include?(option['value']) + option_name = option['value'].presence || "Option #{field['options'].index(option) + 1}" + + value = Array.wrap(value).include?(option_name) end next unless value == true