diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 19 |
1 files changed, 7 insertions, 12 deletions
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<Position> 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; } } |