From 2c9cbb340ff17a8af0129ab7a4ffa9e535c26a22 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 16 Sep 2015 19:07:26 +1200 Subject: Update position only when latest --- src/org/traccar/DefaultDataHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/DefaultDataHandler.java b/src/org/traccar/DefaultDataHandler.java index d75b62dee..cb35baceb 100644 --- a/src/org/traccar/DefaultDataHandler.java +++ b/src/org/traccar/DefaultDataHandler.java @@ -25,7 +25,10 @@ public class DefaultDataHandler extends BaseDataHandler { try { Context.getDataManager().addPosition(position); - Context.getDataManager().updateLatestPosition(position); + Position lastPosition = Context.getConnectionManager().getLastPosition(position.getDeviceId()); + if (position.getFixTime().compareTo(lastPosition.getFixTime()) > 0) { + Context.getDataManager().updateLatestPosition(position); + } } catch (Exception error) { Log.warning(error); } -- cgit v1.2.3