diff --git a/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts b/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts index c02273f..0663fc1 100644 --- a/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts +++ b/projects/project-3/frontend/src/app/dashboard/dashboard.component.ts @@ -54,7 +54,6 @@ export class DashboardComponent implements OnInit { stationToSource = new MatTableDataSource(); stationFromSource = new MatTableDataSource(); - station: IDashboardCommonBikePoint; maxStartDate: Date; maxEndDate: Date; @@ -62,7 +61,6 @@ export class DashboardComponent implements OnInit { actualEndDate: Date; form: FormGroup; - constructor( private route: ActivatedRoute, private service: DashboardService, @@ -97,7 +95,7 @@ export class DashboardComponent implements OnInit { } ngOnInit(): void { - this.service.fetch_dashboard_init(this.route.snapshot.paramMap.get('id')).then(data => { + this.service.fetchDashboardInit(this.route.snapshot.paramMap.get('id')).then(data => { this.station = data; this.maxStartDate = new Date(data.maxStartDate); this.maxEndDate = new Date(data.maxEndDate); @@ -114,15 +112,15 @@ export class DashboardComponent implements OnInit { init_dashboard(): void { const initDate = this.maxEndDate.toISOString().substring(0, 10); - this.service.fetch_dashboard_station_to(this.station.id, initDate, initDate).then((source) => { + this.service.fetchDashboardStationTo(this.station.id, initDate, initDate).then((source) => { this.stationToSource = source; this.changeDetectorRefs.detectChanges(); }); - this.service.fetch_dashboard_station_from(this.station.id, initDate, initDate).then((source) => { + this.service.fetchDashboardStationFrom(this.station.id, initDate, initDate).then((source) => { this.stationFromSource = source; this.changeDetectorRefs.detectChanges(); }); - this.service.fetch_dashboard_station_charts(this.station.id, initDate, initDate, 'duration').then((source) => { + this.service.fetchDashboardStationCharts(this.station.id, initDate, initDate, 'duration').then((source) => { const numbers = []; const minutesGroup = []; source.forEach(value => { @@ -173,7 +171,7 @@ export class DashboardComponent implements OnInit { } }; }); - this.service.fetch_dashboard_station_charts(this.station.id, initDate, initDate, 'time').then((source) => { + this.service.fetchDashboardStationCharts(this.station.id, initDate, initDate, 'time').then((source) => { const timeFrame = []; const numbers = []; const avgDuration = []; @@ -231,14 +229,14 @@ export class DashboardComponent implements OnInit { }; }); - this.map.draw_dashboard_map(this.station.lat, this.station.lon, 17); - this.map.draw_dashboard_station_marker(this.station.lat, this.station.lon); + this.map.drawDashboardMap(this.station.lat, this.station.lon, 17); + this.map.drawDashboardStationMarker(this.station.lat, this.station.lon); } onSubmit(): void { this.actualStartDate = this.form.get('daterange').value.start; this.actualEndDate = this.form.get('daterange').value.end; - this.service.fetch_dashboard_station_to( + this.service.fetchDashboardStationTo( this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualEndDate.toISOString().substring(0, 10) @@ -246,7 +244,7 @@ export class DashboardComponent implements OnInit { this.stationToSource = source; this.changeDetectorRefs.detectChanges(); }); - this.service.fetch_dashboard_station_from( + this.service.fetchDashboardStationFrom( this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualEndDate.toISOString().substring(0, 10) @@ -254,7 +252,7 @@ export class DashboardComponent implements OnInit { this.stationFromSource = source; this.changeDetectorRefs.detectChanges(); }); - this.service.fetch_dashboard_station_charts( + this.service.fetchDashboardStationCharts( this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualEndDate.toISOString().substring(0, 10), @@ -310,7 +308,7 @@ export class DashboardComponent implements OnInit { } }; }); - this.service.fetch_dashboard_station_charts( + this.service.fetchDashboardStationCharts( this.station.id, this.actualStartDate.toISOString().substring(0, 10), this.actualEndDate.toISOString().substring(0, 10), diff --git a/projects/project-3/frontend/src/app/service/dashboard.service.ts b/projects/project-3/frontend/src/app/service/dashboard.service.ts index 567ac4b..9ae86f1 100644 --- a/projects/project-3/frontend/src/app/service/dashboard.service.ts +++ b/projects/project-3/frontend/src/app/service/dashboard.service.ts @@ -10,23 +10,23 @@ export class DashboardService { constructor(private client: HttpClient) { } - public async fetch_dashboard_init(id: string): Promise { + public async fetchDashboardInit(id: string): Promise { return await this.client.get(environment.apiUrl + `latest/dashboard/${id}/`).toPromise(); } - public async fetch_dashboard_station_to(id: string, startDate: string, endDate: string): Promise { + public async fetchDashboardStationTo(id: string, startDate: string, endDate: string): Promise { return await this.client.get( environment.apiUrl + `latest/dashboard/${id}/to?start_date=${startDate}&end_date=${endDate}` ).toPromise(); } - public async fetch_dashboard_station_from(id: string, startDate: string, endDate: string): Promise { + public async fetchDashboardStationFrom(id: string, startDate: string, endDate: string): Promise { return await this.client.get( environment.apiUrl + `latest/dashboard/${id}/from?start_date=${startDate}&end_date=${endDate}` ).toPromise(); } - public async fetch_dashboard_station_charts(id: string, startDate: string, endDate: string, type: string): Promise { + public async fetchDashboardStationCharts(id: string, startDate: string, endDate: string, type: string): Promise { return await this.client.get( environment.apiUrl + `latest/dashboard/${id}/${type}?start_date=${startDate}&end_date=${endDate}` ).toPromise();