Browse Source

feat: display location name and postcode in scheme iff inferred

pull/1460/head
natdeanlewissoftwire 3 years ago
parent
commit
836ca73b9e
  1. 9
      app/models/form/lettings/questions/scheme_id.rb
  2. 2
      app/models/form/question.rb
  3. 2
      db/schema.rb

9
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)

2
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)

2
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

Loading…
Cancel
Save