bug fix map view, code refactoring
lbs-gitea/maptology/master This commit looks good

This commit is contained in:
ilhangeoksu
2018-02-04 16:53:47 +01:00
parent e72ea20a4c
commit 10b0a39b04
@@ -100,9 +100,6 @@ export class PlaceComponent implements OnInit {
}).addTo(this.markersLayer).bindPopup("<br>"+place.nickname+"</br>"+place.address).openPopup();
}
this.map.fitBounds(this.markersLayer.getBounds());
console.log("------- place attibutes");
console.log(this.places);
}
getVisits(){
@@ -112,12 +109,12 @@ export class PlaceComponent implements OnInit {
var duration = (24*60*60*1000); // duration = milliseconds of one day
this.apiClientService.getDeviceVisits(this.selectedDevice.id,
startDate.getTime(), duration).subscribe(result => {
console.log("visits response");
console.log(result.body);
this.visits = this.groupVisitsOnPlaceId(result.body);
console.log("grouped visits response");
console.log(this.visits);
this.getPlaces();
if(this.visits.length == 0){
this.toastService.showWarning("Warnung","Keine Standortdaten für den ausgewählten Tag/Gerät gefunden");
}else{
this.getPlaces();
}
}, error=>{
this.consoleService.log("Error during get visits.");
this.helperService.handleError(error);
@@ -128,11 +125,10 @@ export class PlaceComponent implements OnInit {
Observable.forkJoin(
this.visits.map(visit => this.apiClientService.getPlace(visit.place))
).subscribe(responseList => {
console.log("response list: ");
console.log(responseList);
for(let response of responseList){
this.places.push(response.body);
}
if(responseList.length == 0)
this.setMarkersForPlaces();
}, error => {
this.consoleService.log("Error during get places.");
@@ -162,6 +158,7 @@ export class PlaceComponent implements OnInit {
this.places = [];
this.visits = [];
this.markersLayer.clearLayers();
this.map.setZoom(0);
}
// user methods