From 5d3eb5136b96c8667021ef4d9452b4008ff40e42 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 16 Aug 2017 16:13:26 +0500 Subject: Revert check for gap --- src/org/traccar/reports/ReportUtils.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index db2d59a5d..6a5370d15 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -250,18 +250,13 @@ public final class ReportUtils { private static boolean isMoving(ArrayList positions, int index, TripsConfig tripsConfig, double speedThreshold) { if (tripsConfig.getMinimalNoDataDuration() > 0) { - long positionsDfference = 0; - if (index < positions.size() - 1) { - positionsDfference = positions.get(index + 1).getFixTime().getTime() - - positions.get(index).getFixTime().getTime(); - } - if (positionsDfference >= tripsConfig.getMinimalNoDataDuration()) { - return false; - } else if (index > 0) { - positionsDfference = positions.get(index).getFixTime().getTime() - - positions.get(index - 1).getFixTime().getTime(); - } - if (positionsDfference >= tripsConfig.getMinimalNoDataDuration()) { + boolean beforeGap = index < positions.size() - 1 + && positions.get(index + 1).getFixTime().getTime() - positions.get(index).getFixTime().getTime() + >= tripsConfig.getMinimalNoDataDuration(); + boolean afterGap = index > 0 + && positions.get(index).getFixTime().getTime() - positions.get(index - 1).getFixTime().getTime() + >= tripsConfig.getMinimalNoDataDuration(); + if (beforeGap || afterGap) { return false; } } -- cgit v1.2.3