diff --git a/app/models/form/lettings/questions/scheme_id.rb b/app/models/form/lettings/questions/scheme_id.rb index a9147ba5f..487b1b2c4 100644 --- a/app/models/form/lettings/questions/scheme_id.rb +++ b/app/models/form/lettings/questions/scheme_id.rb @@ -9,6 +9,11 @@ class Form::Lettings::Questions::SchemeId < ::Form::Question @guidance_position = GuidancePosition::BOTTOM @guidance_partial = "scheme_selection" @question_number = 9 + @inferred_answers = { + "location.name": { + "scheme_has_multiple_locations?": false, + }, + } end def answer_options @@ -41,6 +46,10 @@ class Form::Lettings::Questions::SchemeId < ::Form::Question !supported_housing_selected?(lettings_log) end + def get_extra_check_answer_value(lettings_log) + lettings_log.form.get_question("postcode_full", nil).label_from_value(lettings_log.postcode_full) unless lettings_log.scheme_has_multiple_locations? + end + private def supported_housing_selected?(lettings_log) diff --git a/app/models/form/question.rb b/app/models/form/question.rb index de77674e6..9590a8e17 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -317,7 +317,7 @@ private end def enabled_inferred_answers(inferred_answers, log) - inferred_answers.filter { |_key, value| value.all? { |condition_key, condition_value| log[condition_key] == condition_value } } + inferred_answers.filter { |_key, value| value.all? { |condition_key, condition_value| log.public_send(condition_key) == condition_value } } end def inferred_answer_value(log) diff --git a/db/schema.rb b/db/schema.rb index 92b0d9a63..225129dfd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -569,8 +569,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_20_084057) do t.string "town_or_city" t.string "county" t.integer "nationalbuy2" - t.integer "student_not_child_value_check" t.integer "discounted_sale_value_check" + t.integer "student_not_child_value_check" t.index ["bulk_upload_id"], name: "index_sales_logs_on_bulk_upload_id" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["old_id"], name: "index_sales_logs_on_old_id", unique: true