Browse Source

feat: align with similar PR for 23/24

pull/1397/head
natdeanlewissoftwire 3 years ago
parent
commit
03b0aa6a5d
  1. 27
      app/models/log.rb

27
app/models/log.rb

@ -135,10 +135,33 @@ private
process_postcode(ppostcode_full, "ppcodenk", "is_previous_la_inferred", "prevloc")
end
LA_CHANGES = {
"E07000027" => "E06000063", # Barrow-in-Furness => Cumberland
"E07000030" => "E06000063", # Eden => Cumberland
"E07000031" => "E06000063", # South Lakeland => Cumberland
"E07000026" => "E06000064", # Allerdale => Westmorland and Furness
"E07000028" => "E06000064", # Carlisle => Westmorland and Furness
"E07000029" => "E06000064", # Copeland => Westmorland and Furness
"E07000163" => "E06000065", # Craven => North Yorkshire
"E07000164" => "E06000065", # Hambleton => North Yorkshire
"E07000165" => "E06000065", # Harrogate => North Yorkshire
"E07000166" => "E06000065", # Richmondshire => North Yorkshire
"E07000167" => "E06000065", # Ryedale => North Yorkshire
"E07000168" => "E06000065", # Scarborough => North Yorkshire
"E07000169" => "E06000065", # Selby => North Yorkshire
"E07000187" => "E06000066", # Mendip => Somerset
"E07000188" => "E06000066", # Sedgemoor => Somerset
"E07000246" => "E06000066", # Somerset West and Taunton => Somerset
"E07000189" => "E06000066", # South Somerset => Somerset
}.freeze
def get_inferred_la(postcode)
result = PIO.lookup(postcode)
if result && !(form.start_date.year < 2023 && new_2023_admin_district_codes.include?(result[:location_code]))
result[:location_code]
location_code = result[:location_code] if result
if LA_CHANGES.value?(location_code) && form.start_date.year < 2023
nil
else
location_code
end
end

Loading…
Cancel
Save