Évol pour afficher le total de sauts et 1-2 infos
sur le dernier saut
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
import { map } from "rxjs/operators";
|
||||
import { environment } from "../environments/environment";
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { environment } from '../environments/environment';
|
||||
import {
|
||||
StatsResp,
|
||||
StatsByDzResp,
|
||||
@@ -11,20 +11,23 @@ import {
|
||||
StatsByGearResp,
|
||||
StatsByYearResp,
|
||||
StatsForLastMonthResp,
|
||||
StatsForLastYearResp
|
||||
} from "../models/stats";
|
||||
StatsForLastYearResp,
|
||||
SimpleSummary
|
||||
} from '../models/stats';
|
||||
|
||||
@Injectable()
|
||||
export class StatsService {
|
||||
private readonly headers = new HttpHeaders({
|
||||
"Access-Control-Allow-Origin": environment.urlApi
|
||||
'Access-Control-Allow-Origin': environment.urlApi
|
||||
});
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
public getStatsOfJumps(): StatsResp {
|
||||
const resultats = new StatsResp();
|
||||
|
||||
resultats.simpleSummary = this.getSimpleSummary();
|
||||
|
||||
resultats.statsByDz = this.getStatsByDz();
|
||||
resultats.statsByAircraft = this.getStatsByAircraft();
|
||||
resultats.statsByJumpType = this.getStatsByJumpType();
|
||||
@@ -37,6 +40,19 @@ export class StatsService {
|
||||
return resultats;
|
||||
}
|
||||
|
||||
private getSimpleSummary(): Observable<SimpleSummary> {
|
||||
return this.http
|
||||
.get<Array<SimpleSummary>>(`${environment.urlApi}/api/Stats/Simple`, {
|
||||
headers: this.headers
|
||||
})
|
||||
.pipe(
|
||||
map(response => {
|
||||
const stats = new SimpleSummary(response);
|
||||
return stats;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private getStatsByDz(): Observable<Array<StatsByDzResp>> {
|
||||
return this.http
|
||||
.get<Array<StatsByDzResp>>(`${environment.urlApi}/api/Stats/ByDz`, {
|
||||
|
||||
Reference in New Issue
Block a user