From 332fe1cc168e32fed664d2156a900f8e00acea8a Mon Sep 17 00:00:00 2001 From: Vitaly Litvak Date: Fri, 3 Apr 2015 10:54:19 +0300 Subject: [PATCH] For #100 - devices-geofences map was updated incorrectly after geo-fence saving --- .../web/client/controller/GeoFenceController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/traccar/web/client/controller/GeoFenceController.java b/src/main/java/org/traccar/web/client/controller/GeoFenceController.java index 3c13f570..093fabf0 100644 --- a/src/main/java/org/traccar/web/client/controller/GeoFenceController.java +++ b/src/main/java/org/traccar/web/client/controller/GeoFenceController.java @@ -144,6 +144,10 @@ public void onSuccess(GeoFence geoFence) { } geoFenceStore.update(geoFence); geoFenceStore.applySort(false); + for (Collection geoFences : deviceGeoFences.values()) { + geoFences.remove(geoFence); + } + geoFenceAdded(geoFence); geoFenceManagementStopped(); } @@ -212,10 +216,12 @@ public void onSelected(GeoFence geoFence) { if (selectedGeoFence != null && !selectedGeoFence.isAllDevices()) { mapController.removeGeoFence(selectedGeoFence); } - if (!geoFence.isAllDevices()) { - mapController.drawGeoFence(geoFence, true); + if (geoFence != null) { + if (!geoFence.isAllDevices()) { + mapController.drawGeoFence(geoFence, true); + } + mapController.selectGeoFence(geoFence); } - mapController.selectGeoFence(geoFence); selectedGeoFence = geoFence; }