diff --git a/app/services/reverse_geocoding/places/fetch_data.rb b/app/services/reverse_geocoding/places/fetch_data.rb index 9f1551c5..240ac6de 100644 --- a/app/services/reverse_geocoding/places/fetch_data.rb +++ b/app/services/reverse_geocoding/places/fetch_data.rb @@ -112,13 +112,13 @@ class ReverseGeocoding::Places::FetchData place.country = data['properties']['country'] place.geodata = data place.source = :photon - if place.lonlat.nil? + + if place.lonlat.blank? place.lonlat = build_point_coordinates(data['geometry']['coordinates']) end end def save_places(places_to_create, places_to_update) - # Bulk insert for new places if places_to_create.any? place_attributes = places_to_create.map do |place| { @@ -136,7 +136,7 @@ class ReverseGeocoding::Places::FetchData end Place.insert_all(place_attributes) end - + # Individual updates for existing places places_to_update.each(&:save!) if places_to_update.any? end diff --git a/app/views/stats/_year.html.erb b/app/views/stats/_year.html.erb index 3d8989b8..fc5fd1e6 100644 --- a/app/views/stats/_year.html.erb +++ b/app/views/stats/_year.html.erb @@ -4,7 +4,9 @@