diff options
author | Abyss777 <abyss@fox5.ru> | 2016-11-23 17:34:25 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-11-23 17:34:25 +0500 |
commit | e89bbb8ee9dd1dd1f19fb33f1f9291c6ae5f43db (patch) | |
tree | 51376f73260c9bbc89064ba2b5f2a428b6d46785 /src/org/traccar/events/MaintenanceEventHandler.java | |
parent | dbbe99269140f057d3f72acca557730a6b10e902 (diff) | |
download | trackermap-server-e89bbb8ee9dd1dd1f19fb33f1f9291c6ae5f43db.tar.gz trackermap-server-e89bbb8ee9dd1dd1f19fb33f1f9291c6ae5f43db.tar.bz2 trackermap-server-e89bbb8ee9dd1dd1f19fb33f1f9291c6ae5f43db.zip |
Implement attributes helpers
Diffstat (limited to 'src/org/traccar/events/MaintenanceEventHandler.java')
-rw-r--r-- | src/org/traccar/events/MaintenanceEventHandler.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/org/traccar/events/MaintenanceEventHandler.java b/src/org/traccar/events/MaintenanceEventHandler.java index 466e0b617..f423e035b 100644 --- a/src/org/traccar/events/MaintenanceEventHandler.java +++ b/src/org/traccar/events/MaintenanceEventHandler.java @@ -50,13 +50,10 @@ public class MaintenanceEventHandler extends BaseEventHandler { double newTotalDistance = 0.0; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); - if (lastPosition != null && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { - oldTotalDistance = ((Number) lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); - } - - if (position.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { - newTotalDistance = ((Number) position.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); + if (lastPosition != null) { + oldTotalDistance = lastPosition.getDouble(Position.KEY_TOTAL_DISTANCE); } + newTotalDistance = position.getDouble(Position.KEY_TOTAL_DISTANCE); oldTotalDistance -= maintenanceStart; newTotalDistance -= maintenanceStart; |