Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7 lines
391 B

desc "Infers location admin district for locations from location code where it's missing"
task correct_location_admin_district: :environment do
Location.where.not(location_code: nil).where(location_admin_district: nil).each do |location|
location.update(location_admin_district: LocalAuthority.all.active(Time.zone.today).england.find_by(code: location.location_code)&.name)
end
end