diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-08-17 23:50:14 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-17 23:50:14 +1200 |
commit | a1f7908769d296aed7766151340426e612883c6f (patch) | |
tree | 243c8f95a4a2728e3b2dcbf7c2b81805a9e59032 /src | |
parent | 9e9f97ac34d882594e3d23e959775ce765447787 (diff) | |
parent | ad18dad83638ac2b003596eb1b6226bb9c407abc (diff) | |
download | trackermap-server-a1f7908769d296aed7766151340426e612883c6f.tar.gz trackermap-server-a1f7908769d296aed7766151340426e612883c6f.tar.bz2 trackermap-server-a1f7908769d296aed7766151340426e612883c6f.zip |
Merge pull request #3450 from Abyss777/fix_trip_detector
Fix trips and stops detector
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 20 |
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()) { |