From 29c63d9bf48623ef11e89399e4c7c0e09bf1c446 Mon Sep 17 00:00:00 2001 From: soshial Date: Mon, 27 Dec 2021 15:38:46 +0400 Subject: revert to the original filtering logic --- src/main/java/org/traccar/handler/FilterHandler.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/traccar/handler/FilterHandler.java b/src/main/java/org/traccar/handler/FilterHandler.java index 6331ff773..e8cafabc8 100644 --- a/src/main/java/org/traccar/handler/FilterHandler.java +++ b/src/main/java/org/traccar/handler/FilterHandler.java @@ -147,12 +147,9 @@ public class FilterHandler extends BaseDataHandler { private boolean filter(Position position) { - if (skipAttributes(position)) { - return false; - } - StringBuilder filterType = new StringBuilder(); + // filter out invalid data if (filterInvalid(position)) { filterType.append("Invalid "); } @@ -168,10 +165,8 @@ public class FilterHandler extends BaseDataHandler { if (filterApproximate(position)) { filterType.append("Approximate "); } - if (filterStatic(position)) { - filterType.append("Static "); - } + // filter out excessive data long deviceId = position.getDeviceId(); if (filterDuplicate || filterDistance > 0 || filterMaxSpeed > 0 || filterMinPeriod > 0) { Position preceding = null; @@ -186,13 +181,13 @@ public class FilterHandler extends BaseDataHandler { } else { preceding = getLastReceivedPosition(deviceId); } - if (skipLimit(position, preceding)) { - return false; - } if (filterDuplicate(position, preceding)) { filterType.append("Duplicate "); } - if (filterDistance(position, preceding)) { + if (filterStatic(position) && !skipLimit(position, preceding) && !skipAttributes(position)) { + filterType.append("Static "); + } + if (filterDistance(position, preceding) && !skipLimit(position, preceding) && !skipAttributes(position)) { filterType.append("Distance "); } if (filterMaxSpeed(position, preceding)) { -- cgit v1.2.3