]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/trace.rb
Potlatch 0.10
[rails.git] / app / models / trace.rb
index ab99dc2900a2d1962f0316b542616b3dea2afc77..d28c2c6f42f98a1bf6bff40b769c9707b0e71515 100644 (file)
@@ -183,7 +183,7 @@ class Trace < ActiveRecord::Base
     # 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
 
@@ -191,6 +191,7 @@ class Trace < ActiveRecord::Base
       if first
         f_lat = point['latitude']
         f_lon = point['longitude']
+        first = false
       end
 
       tp = Tracepoint.new