diff options
-rw-r--r-- | src/org/traccar/FilterHandler.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index bcc958e59..08be43f65 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -138,13 +138,17 @@ public class FilterHandler extends BaseDataHandler { return false; } - private boolean filterLimit(Position position, Position last) { + private boolean skipLimit(Position position, Position last) { if (filterLimit != 0 && last != null) { return (position.getFixTime().getTime() - last.getFixTime().getTime()) > filterLimit; } return false; } + private boolean skipAlarms(Position position) { + return keepAlarms && position.getAttributes().containsKey(Position.KEY_ALARM); + } + private boolean filter(Position position) { StringBuilder filterType = new StringBuilder(); @@ -154,7 +158,7 @@ public class FilterHandler extends BaseDataHandler { last = Context.getIdentityManager().getLastPosition(position.getDeviceId()); } - if (filterLimit(position, last) || keepAlarms && position.getAttributes().containsKey(Position.KEY_ALARM)) { + if (skipLimit(position, last) || skipAlarms(position)) { return false; } |