X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/38369675b7b574c044a178d9f67ce91ed3d407c1..01cbc40ed62f006398bcce62fc1f449b432b59b1:/app/models/trace.rb diff --git a/app/models/trace.rb b/app/models/trace.rb index 35fee0bf4..2411fb9b7 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -209,7 +209,7 @@ class Trace < ApplicationRecord first = true # If there are any existing points for this trace then delete them - Tracepoint.where(:gpx_id => id).delete_all + Tracepoint.where(:trace => id).delete_all gpx.points.each_slice(1_000) do |points| # Gather the trace points together for a bulk import @@ -242,10 +242,10 @@ class Trace < ApplicationRecord end if gpx.actual_points.positive? - max_lat = Tracepoint.where(:gpx_id => id).maximum(:latitude) - min_lat = Tracepoint.where(:gpx_id => id).minimum(:latitude) - max_lon = Tracepoint.where(:gpx_id => id).maximum(:longitude) - min_lon = Tracepoint.where(:gpx_id => id).minimum(:longitude) + max_lat = Tracepoint.where(:trace => id).maximum(:latitude) + min_lat = Tracepoint.where(:trace => id).minimum(:latitude) + max_lon = Tracepoint.where(:trace => id).maximum(:longitude) + min_lon = Tracepoint.where(:trace => id).minimum(:longitude) max_lat = max_lat.to_f / 10000000 min_lat = min_lat.to_f / 10000000