diff --git a/static/js/index/index_map.js b/static/js/index/index_map.js index e1b3d7c..f70bc05 100644 --- a/static/js/index/index_map.js +++ b/static/js/index/index_map.js @@ -1,6 +1,6 @@ const MAXNUMCOORD = 100; const PINGWAITTIME = 1000*1; //1s -const MAXIMGROTATION = max_img_rotation; +const MAXIMGROTATION = parseInt(max_img_rotation); const OSMURL='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; const OSMATTRIB='Map data © OpenStreetMap contributors'; @@ -44,11 +44,11 @@ class MapEventManager { } addMapEvent(mapevent) { - if(this._mapEventArray.length >= MAXIMGROTATION) { + if(this.getNumberOfEvent() > MAXIMGROTATION) { var toDel = this._mapEventArray[0]; toDel.marker.remove(); // remove marker this._coordSet.delete(toDel.text); - this._mapEventArray.slice(1); + this._mapEventArray = this._mapEventArray.slice(1); } if(!this._coordSet.has(mapevent.text)) { // avoid duplicate map @@ -124,7 +124,7 @@ class MapEventManager { this._curMarkerNum = this._curMarkerNum >= MAXNUMCOORD ? 0 : this._curMarkerNum+1; if (this._allMarkers.length >= MAXNUMCOORD) { - to_remove = this._allMarkers[0]; + var to_remove = this._allMarkers[0]; openStreetMapObj.removeMarkers([to_remove]); this._allMarkers = this._allMarkers.slice(1); } diff --git a/zmq_subscriber.py b/zmq_subscriber.py index 4e70ee8..4c53895 100755 --- a/zmq_subscriber.py +++ b/zmq_subscriber.py @@ -91,7 +91,7 @@ def getCoordAndPublish(zmq_name, supposed_ip, categ): serv_coord.publish(CHANNELDISP, json.dumps(to_send)) except ValueError: print("can't resolve ip") - except ip2.errors.AddressNotFoundError: + except geoip2.errors.AddressNotFoundError: print("Address not in Database") def getFields(obj, fields):