aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-17 16:37:29 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-17 16:37:29 +0500
commitad18dad83638ac2b003596eb1b6226bb9c407abc (patch)
tree243c8f95a4a2728e3b2dcbf7c2b81805a9e59032 /src/org
parent9e9f97ac34d882594e3d23e959775ce765447787 (diff)
downloadtraccar-server-ad18dad83638ac2b003596eb1b6226bb9c407abc.tar.gz
traccar-server-ad18dad83638ac2b003596eb1b6226bb9c407abc.tar.bz2
traccar-server-ad18dad83638ac2b003596eb1b6226bb9c407abc.zip
Fix trip detector
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/reports/ReportUtils.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index 46aea0757..74cdaf9b5 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -284,17 +284,21 @@ public final class ReportUtils {
for (int i = 0; i < positions.size(); i++) {
Map<Event, Position> event = motionHandler.updateMotionState(deviceState, positions.get(i),
isMoving(positions, i, tripsConfig, speedThreshold));
- if (deviceState.getMotionPosition() != null && startEventIndex == -1
- && trips != deviceState.getMotionState()) {
+ if (startEventIndex == -1
+ && (trips != deviceState.getMotionState() && deviceState.getMotionPosition() != null
+ || trips == deviceState.getMotionState() && event != null)) {
startEventIndex = i;
startNoEventIndex = -1;
+ } else if (trips != deviceState.getMotionState() && startEventIndex != -1
+ && deviceState.getMotionPosition() == null && event == null) {
+ startEventIndex = -1;
}
- if (trips == deviceState.getMotionState()) {
- if (startNoEventIndex == -1) {
- startNoEventIndex = i;
- } else if (deviceState.getMotionPosition() == null) {
- startNoEventIndex = -1;
- }
+ if (startNoEventIndex == -1
+ && (trips == deviceState.getMotionState() && deviceState.getMotionPosition() != null
+ || trips != deviceState.getMotionState() && event != null)) {
+ startNoEventIndex = i;
+ } else if (startNoEventIndex != -1 && deviceState.getMotionPosition() == null && event == null) {
+ startNoEventIndex = -1;
}
if (startEventIndex != -1 && startNoEventIndex != -1 && event != null
&& trips != deviceState.getMotionState()) {