|
|
|
|
@ -20,7 +20,7 @@ class Form::Lettings::Questions::LocationId < ::Form::Question
|
|
|
|
|
answer_opts = {} |
|
|
|
|
return answer_opts unless ActiveRecord::Base.connected? |
|
|
|
|
|
|
|
|
|
Location.started_in_2_weeks.select(:id, :postcode, :name).each_with_object(answer_opts) do |location, hsh| |
|
|
|
|
Location.visible.started_in_2_weeks.select(:id, :postcode, :name).each_with_object(answer_opts) do |location, hsh| |
|
|
|
|
hsh[location.id.to_s] = { "value" => location.postcode, "hint" => location.name } |
|
|
|
|
hsh |
|
|
|
|
end |
|
|
|
|
@ -29,7 +29,7 @@ class Form::Lettings::Questions::LocationId < ::Form::Question
|
|
|
|
|
def displayed_answer_options(lettings_log, _user = nil) |
|
|
|
|
return {} unless lettings_log.scheme |
|
|
|
|
|
|
|
|
|
scheme_location_ids = lettings_log.scheme.locations.confirmed.pluck(:id) |
|
|
|
|
scheme_location_ids = lettings_log.scheme.locations.visible.confirmed.pluck(:id) |
|
|
|
|
answer_options.select { |k, _v| scheme_location_ids.include?(k.to_i) } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|