diff --git a/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html b/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html index db5e444..e9f703e 100644 --- a/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html +++ b/Front/skydivelogs-app/src/app/list-of-tunnel-flights/list-of-tunnel-flights.component.html @@ -12,6 +12,12 @@ {{ 'ListTunnelFlight_AllFlights' | translate }} + + + + + +
= []; constructor(private serviceComm: ServiceComm, private serviceTunnelFlight: TunnelFlightService, @@ -138,14 +139,18 @@ export class ListOfTunnelFlightsComponent implements OnInit { } private computeTimeByType(stats: TunnelFlightByMonth[]) { + this.stats = []; from(stats).pipe( groupBy((type) => type.type, { element: (p) => p.nb }), mergeMap((group$) => group$.pipe(reduce((acc, cur) => [...acc, cur], [`${group$.key}`])) ), - map((arr) => ({ id: arr[0], values: arr.slice(1) })) + map((arr) => ({ id: arr[0], values: arr.slice(1).reduce((a, b) => Number(a) + Number(b), 0) })) ) - .subscribe((p) => console.log(p)); + .subscribe((p) => { + console.log(p); + this.stats.push(p); + }); } private getMontsBetweenDates(beginDate: Date, endDate: Date): Array { diff --git a/Front/skydivelogs-app/src/interceptor/caching.interceptor.ts b/Front/skydivelogs-app/src/interceptor/caching.interceptor.ts index 896a069..a0b28d1 100644 --- a/Front/skydivelogs-app/src/interceptor/caching.interceptor.ts +++ b/Front/skydivelogs-app/src/interceptor/caching.interceptor.ts @@ -1,9 +1,10 @@ import { Injectable } from '@angular/core'; import { HttpEvent, HttpRequest, HttpResponse, HttpInterceptor, HttpHandler } from '@angular/common/http'; -import { Observable } from 'rxjs/Observable'; +// import { Observable } from 'rxjs/Observable'; +// import 'rxjs/add/observable/of'; import { tap } from 'rxjs/operators'; -import 'rxjs/add/observable/of'; +import { Observable, of } from 'rxjs'; import { RequestCache } from '../services/request-cache.service'; @@ -13,7 +14,7 @@ export class CachingInterceptor implements HttpInterceptor { intercept(req: HttpRequest, next: HttpHandler) { const cachedResponse = this.cache.get(req); - return cachedResponse ? Observable.of(cachedResponse) : this.sendRequest(req, next); + return cachedResponse ? of(cachedResponse) : this.sendRequest(req, next); } sendRequest(req: HttpRequest, next: HttpHandler): Observable> {