]> git.openstreetmap.org Git - rails.git/commitdiff
Fix new rubocop warnings
authorTom Hughes <tom@compton.nu>
Tue, 15 Oct 2024 17:25:30 +0000 (18:25 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 15 Oct 2024 17:25:30 +0000 (18:25 +0100)
app/models/relation.rb
lib/gpx.rb

index f09647320004f99dc1734964a3e265ffb97b272e..69e2acfd19ce3222f425c9734d983ede7b630101 100644 (file)
@@ -234,7 +234,7 @@ class Relation < ApplicationRecord
       element = model.lock("for share").find_by(:id => m[1])
 
       # and check that it is OK to use.
-      raise OSM::APIPreconditionFailedError, "Relation with id #{id} cannot be saved due to #{m[0]} with id #{m[1]}" unless element&.visible? && element&.preconditions_ok?
+      raise OSM::APIPreconditionFailedError, "Relation with id #{id} cannot be saved due to #{m[0]} with id #{m[1]}" unless element&.visible? && element.preconditions_ok?
 
       hash[m[1]] = true
     end
index 1bf7764ec5e3052f878c394f4ae75f9e1c9e879c..45a4dcf5fc0bd62335ea0339409e2c1fbfd49e6d 100644 (file)
@@ -27,7 +27,7 @@ module GPX
             point.timestamp = Time.parse(reader.read_string).utc
           end
         when XML::Reader::TYPE_END_ELEMENT
-          if reader.name == "trkpt" && point && point.valid?
+          if reader.name == "trkpt" && point&.valid?
             point.altitude ||= 0
             yield point
             @actual_points += 1