diff --git a/app/helpers/conditional_questions_helper.rb b/app/helpers/conditional_questions_helper.rb index be6a9910a..c174c2692 100644 --- a/app/helpers/conditional_questions_helper.rb +++ b/app/helpers/conditional_questions_helper.rb @@ -1,6 +1,6 @@ module ConditionalQuestionsHelper def conditional_questions_for_page(page) - page.questions.map(&:conditional_for).compact.map(&:keys).flatten.map(&:to_s) + page.questions.map(&:conditional_for).compact.map(&:keys).flatten end def find_conditional_question(page, question, answer_value) @@ -9,10 +9,10 @@ module ConditionalQuestionsHelper conditional_key = question.conditional_for.find { |_, conditional_value| conditional_value.map(&:to_s).include? answer_value.to_s }&.first - page.questions.find { |q| q.id.to_s == conditional_key.to_s } + page.questions.find { |q| q.id == conditional_key } end def display_question_key_div(page, question) - "style='display:none;'".html_safe if conditional_questions_for_page(page).include?(question.id.to_s) || question.requires_js + "style='display:none;'".html_safe if conditional_questions_for_page(page).include?(question.id) || question.requires_js end end diff --git a/app/models/form/sales/questions/outright_ownership_type.rb b/app/models/form/sales/questions/outright_ownership_type.rb index 6c1ce2ba7..494722031 100644 --- a/app/models/form/sales/questions/outright_ownership_type.rb +++ b/app/models/form/sales/questions/outright_ownership_type.rb @@ -8,7 +8,7 @@ class Form::Sales::Questions::OutrightOwnershipType < ::Form::Question @answer_options = ANSWER_OPTIONS @page = page @conditional_for = { - "othtype": [12], + "othtype" => [12], } end diff --git a/spec/models/form/sales/questions/outright_ownership_type_spec.rb b/spec/models/form/sales/questions/outright_ownership_type_spec.rb index 689ff35bc..69b499e52 100644 --- a/spec/models/form/sales/questions/outright_ownership_type_spec.rb +++ b/spec/models/form/sales/questions/outright_ownership_type_spec.rb @@ -40,7 +40,7 @@ RSpec.describe Form::Sales::Questions::OutrightOwnershipType, type: :model do it "has correct conditional for" do expect(question.conditional_for).to eq({ - "othtype": [12], + "othtype" => [12], }) end end