Fix chart

This commit is contained in:
Eugene Burmakin 2025-07-27 20:14:36 +02:00
parent d0bb9ef8d1
commit 25b74716ee
2 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -4,7 +4,9 @@
</h2>
<div class='my-10'>
<%= column_chart(
@year_distances[year],
@year_distances[year].map { |month_name, distance_meters|
[month_name, Stat.convert_distance(distance_meters, current_user.safe_settings.distance_unit).round]
},
height: '200px',
suffix: " #{current_user.safe_settings.distance_unit}",
xtitle: 'Days',