From a6dd63548dc83b16541b3542225a66ee1a605dca Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Thu, 26 Oct 2017 17:17:58 +0200 Subject: [PATCH] Fixed bug multiple days geo queries --- templates/geo.html | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/templates/geo.html b/templates/geo.html index d22f344..c4f05e6 100644 --- a/templates/geo.html +++ b/templates/geo.html @@ -328,20 +328,22 @@ small { var coord = circleRadius._latlng; var dateStart = datePickersRadiusWidgetFrom.datepicker("getDate").getTime() / 1000; var dateEnd = datePickersRadiusWidgetTo.datepicker("getDate").getTime() / 1000; - $.getJSON("{{ url_for('getCoordsByRadius') }}?dateStart="+dateStart+"&dateEnd="+dateEnd+"¢erLat="+coord.lat+"¢erLon="+coord.lng+"&radius="+radius_km, function(list){ + $.getJSON("{{ url_for('getCoordsByRadius') }}?dateStart="+dateStart+"&dateEnd="+dateEnd+"¢erLat="+coord.lat+"¢erLon="+coord.lng+"&radius="+radius_km, function(allList){ // remove old markers for (var i in savedMarkerRadius) { savedMarkerRadius[i].remove(); // remove marker } - var list = list[0]; - for (var dayListIndex in list) { - var jsonData = list[dayListIndex][0]; - var coordJson = list[dayListIndex][1]; + for (var listIndex in allList) { + var list = allList[listIndex]; + for (var dayListIndex in list) { + var jsonData = list[dayListIndex][0]; + var coordJson = list[dayListIndex][1]; - var marker = L.marker([coordJson[1], coordJson[0]]).addTo(radiusOpenStreetMap); - savedMarkerRadius.push(marker); - marker.bindPopup(''+jsonData.categ+'
'+jsonData.value, {autoClose:false}).openPopup(); + var marker = L.marker([coordJson[1], coordJson[0]]).addTo(radiusOpenStreetMap); + savedMarkerRadius.push(marker); + marker.bindPopup(''+jsonData.categ+'
'+jsonData.value, {autoClose:false}).openPopup(); + } } }); } @@ -383,7 +385,6 @@ small { buttonImageOnly: true, buttonText: "Select date", showAnim: "slideDown", - onSelect: updateRadius }; datePickerWidget = $( "#datepicker" )