]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way.rb
Fix rubocop Style/SoleNestedConditional warnings
[rails.git] / app / models / old_way.rb
index e239da16160081552a18b453f7a2fc887d445a17..991925102c4fa9813ca4bccdae1e2f2a7f180df2 100644 (file)
@@ -124,12 +124,10 @@ class OldWay < ApplicationRecord
       curnode = Node.find(n)
       id = n
       reuse = curnode.visible
-      if oldnode.lat != curnode.lat || oldnode.lon != curnode.lon || oldnode.tags != curnode.tags
-        # node has changed: if it's in other ways, give it a new id
-        if curnode.ways - [way_id]
-          id = -1
-          reuse = false
-        end
+      # if node has changed and it's in other ways, give it a new id
+      if !curnode.ways.all?(way_id) && (oldnode.lat != curnode.lat || oldnode.lon != curnode.lon || oldnode.tags != curnode.tags)
+        id = -1
+        reuse = false
       end
       points << [oldnode.lon, oldnode.lat, id, curnode.version, oldnode.tags_as_hash, reuse]
     end