aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 19:07:26 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 19:07:26 +1200
commit2c9cbb340ff17a8af0129ab7a4ffa9e535c26a22 (patch)
tree1c4ea306b68153fa119edde36d6131d559c59f27 /src/org/traccar
parent4c13d0f9ee6b431c215783070f8a1f410697dc7b (diff)
downloadtraccar-server-2c9cbb340ff17a8af0129ab7a4ffa9e535c26a22.tar.gz
traccar-server-2c9cbb340ff17a8af0129ab7a4ffa9e535c26a22.tar.bz2
traccar-server-2c9cbb340ff17a8af0129ab7a4ffa9e535c26a22.zip
Update position only when latest
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/DefaultDataHandler.java5
1 files changed, 4 insertions, 1 deletions
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);
}