diff options
author | Anton Tananaev <anton@traccar.org> | 2023-02-03 14:25:38 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-02-03 14:25:38 -0800 |
commit | 7f7e5a5d479e58e83c8f0f5b81e230f1ed460478 (patch) | |
tree | 58ebe2db4985bd4bf381a0a490c6e36b046fd643 /src/main/java/org/traccar | |
parent | 5e690d9b586c191bc620260a2b7551d52f8d28a2 (diff) | |
download | trackermap-server-7f7e5a5d479e58e83c8f0f5b81e230f1ed460478.tar.gz trackermap-server-7f7e5a5d479e58e83c8f0f5b81e230f1ed460478.tar.bz2 trackermap-server-7f7e5a5d479e58e83c8f0f5b81e230f1ed460478.zip |
Fix fuel events
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/handler/events/FuelEventHandler.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/handler/events/FuelEventHandler.java b/src/main/java/org/traccar/handler/events/FuelEventHandler.java index 462cc4223..a1584d4e4 100644 --- a/src/main/java/org/traccar/handler/events/FuelEventHandler.java +++ b/src/main/java/org/traccar/handler/events/FuelEventHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2022 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2023 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,13 +60,13 @@ public class FuelEventHandler extends BaseEventHandler { if (change > 0) { double threshold = AttributeUtil.lookup( cacheManager, Keys.EVENT_FUEL_INCREASE_THRESHOLD, position.getDeviceId()); - if (change >= threshold) { + if (threshold > 0 && change >= threshold) { return Map.of(new Event(Event.TYPE_DEVICE_FUEL_INCREASE, position), position); } } else if (change < 0) { double threshold = AttributeUtil.lookup( cacheManager, Keys.EVENT_FUEL_DROP_THRESHOLD, position.getDeviceId()); - if (Math.abs(change) >= threshold) { + if (threshold > 0 && Math.abs(change) >= threshold) { return Map.of(new Event(Event.TYPE_DEVICE_FUEL_DROP, position), position); } } |