# If there are any existing points for this trace then delete
# them - we check for existing points first to avoid locking
# the table in the common case where there aren't any.
- if Tracepoint.exists?(['gpx_id = ?', self.id])
+ if Tracepoint.find(:first, :conditions => ['gpx_id = ?', self.id])
Tracepoint.delete_all(['gpx_id = ?', self.id])
end
if first
f_lat = point['latitude']
f_lon = point['longitude']
+ first = false
end
tp = Tracepoint.new