create event if accuracy field missing entirely

stvnrlly 10 lat temu
rodzic
commit
ccf6d7d0e0
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      app/models/agents/user_location_agent.rb

+ 4 - 1
app/models/agents/user_location_agent.rb

@@ -73,7 +73,10 @@ module Agents
73 73
     def handle_payload(payload)
74 74
       location = Location.new(payload)
75 75
 
76
-      if location.present? && (!interpolated[:max_accuracy].present? || payload["accuracy"] < interpolated[:max_accuracy])
76
+      if location.present? && (!interpolated[:max_accuracy].present? || !payload["accuracy"] || payload["accuracy"] < interpolated[:max_accuracy])
77
+        if !payload["accuracy"]
78
+          log "Accuracy field missing; all locations will be kept"
79
+        end
77 80
         create_event payload: payload, location: location
78 81
       end
79 82
     end