diff --git a/scripts/map.js b/scripts/map.js index 0314fbb..4d65dff 100644 --- a/scripts/map.js +++ b/scripts/map.js @@ -171,7 +171,7 @@ async function loadStationMarkersFromArray(stationsArray, showDocks = false) { let iconStyle; - if (station.docks === 0) { + if (station.assetStatus === "repair") { // Deactivated station iconStyle = new ol.style.Style({ diff --git a/scripts/navigation.js b/scripts/navigation.js index 27bd963..9986d51 100644 --- a/scripts/navigation.js +++ b/scripts/navigation.js @@ -198,7 +198,7 @@ async function stopNavigation() { .forEach(layer => map.removeLayer(layer)); // Add back the stations layer (only if user has clicked navigate to stations) - getStations(); + loadStationMarkersFromArray(stationsArray); } // Show cycleways layer diff --git a/scripts/routing.js b/scripts/routing.js index e755125..e75587b 100644 --- a/scripts/routing.js +++ b/scripts/routing.js @@ -772,7 +772,7 @@ function addStationPointToMap(station, start = true) { }); let iconStyle; - if (station.docks !== 0) { + if (station.assetStatus === "active") { const bikeRatio = station.bikes / station.docks; const filled = station.bikes === 0 diff --git a/scripts/stations.js b/scripts/stations.js index 50b12f9..e098b6f 100644 --- a/scripts/stations.js +++ b/scripts/stations.js @@ -62,10 +62,6 @@ async function getStations() { ); if (typeof response !== "undefined") { - // Load the stations to the map - stationsArray = response.data.getStations; - loadStationMarkersFromArray(stationsArray); - return response.data.getStations; } } @@ -115,6 +111,7 @@ async function openStationMenu(stationSerialNumber) { const numDocks = stationObj.dockList.filter(d => d.lockStatus === "unlocked").length - numBikes; // number of free docks const distanceToStation = distance(pos, [lastStationObj.longitude, lastStationObj.latitude]); + console.log(stationObj); // set the inner HTML after the animation has started if (typeof bikeAndDocks.getBikes !== "undefined" && typeof bikeAndDocks.getDocks !== "undefined") { menu.innerHTML = ` @@ -129,7 +126,7 @@ async function openStationMenu(stationSerialNumber) {