Election results in the London Borough of Sutton.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132
  1. # Import postcode data from CodePoint Open
  2. require 'csv'
  3. require_relative "../app"
  4. i = 0
  5. CSV.foreach(ARGV.shift) do |row|
  6. i += 1
  7. next if i == 1 # skip header row
  8. puts i
  9. puts row
  10. puts
  11. ward = District.first(:ons_district_code => row[9])
  12. puts Postcode.create!(
  13. :postcode => row[0],
  14. :positional_quality_indicator => row[1],
  15. :eastings => row[2],
  16. :northings => row[3],
  17. :country_code => row[4],
  18. :nhs_regional_ha_code => row[5],
  19. :nhs_ha_code => row[6],
  20. :admin_county_code => row[7],
  21. :admin_district_code => row[8],
  22. :admin_ward_code => row[9],
  23. :lat => row[10],
  24. :lng => row[11],
  25. :ward_id => ward.id
  26. )
  27. end