Raise exception if there is an error, and import tracepoints in batches

This commit is contained in:
Andy Allan 2019-03-06 09:27:33 +01:00
parent 400db58036
commit 07fdcf638e

View file

@ -313,7 +313,7 @@ class Trace < ActiveRecord::Base
tp.run_callbacks(:save) { false }
tp.run_callbacks(:create) { false }
end
Tracepoint.import(tracepoints)
Tracepoint.import!(tracepoints, :batch_size => 1_000)
if gpx.actual_points.positive?
max_lat = Tracepoint.where(:gpx_id => id).maximum(:latitude)