diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-02-14 12:41:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-14 12:41:21 -0800 |
commit | b1de45ef2496e23a5dfed9b988bf6fa696e90baa (patch) | |
tree | c619872529d59b6d3b6a42f4b361ed7bdd500dd6 /src/org/traccar | |
parent | 6fd9d34b4eaf60289462a87096fdda587ea74482 (diff) | |
parent | 823bc46474e40f0fdb678f22e1269f32f75264c2 (diff) | |
download | trackermap-server-b1de45ef2496e23a5dfed9b988bf6fa696e90baa.tar.gz trackermap-server-b1de45ef2496e23a5dfed9b988bf6fa696e90baa.tar.bz2 trackermap-server-b1de45ef2496e23a5dfed9b988bf6fa696e90baa.zip |
Merge pull request #4223 from iEvgeny/geofences-order
Fixed geofences processing order
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/events/GeofenceEventHandler.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/events/GeofenceEventHandler.java b/src/org/traccar/events/GeofenceEventHandler.java index ea379dbdb..313553195 100644 --- a/src/org/traccar/events/GeofenceEventHandler.java +++ b/src/org/traccar/events/GeofenceEventHandler.java @@ -60,20 +60,20 @@ public class GeofenceEventHandler extends BaseEventHandler { device.setGeofenceIds(currentGeofences); Map<Event, Position> events = new HashMap<>(); - for (long geofenceId : newGeofences) { + for (long geofenceId : oldGeofences) { long calendarId = geofenceManager.getById(geofenceId).getCalendarId(); Calendar calendar = calendarId != 0 ? Context.getCalendarManager().getById(calendarId) : null; if (calendar == null || calendar.checkMoment(position.getFixTime())) { - Event event = new Event(Event.TYPE_GEOFENCE_ENTER, position.getDeviceId(), position.getId()); + Event event = new Event(Event.TYPE_GEOFENCE_EXIT, position.getDeviceId(), position.getId()); event.setGeofenceId(geofenceId); events.put(event, position); } } - for (long geofenceId : oldGeofences) { + for (long geofenceId : newGeofences) { long calendarId = geofenceManager.getById(geofenceId).getCalendarId(); Calendar calendar = calendarId != 0 ? Context.getCalendarManager().getById(calendarId) : null; if (calendar == null || calendar.checkMoment(position.getFixTime())) { - Event event = new Event(Event.TYPE_GEOFENCE_EXIT, position.getDeviceId(), position.getId()); + Event event = new Event(Event.TYPE_GEOFENCE_ENTER, position.getDeviceId(), position.getId()); event.setGeofenceId(geofenceId); events.put(event, position); } |