1e étape pour la récupération des stats
la saison en cours
This commit is contained in:
@@ -9,7 +9,9 @@ import {
|
||||
StatsByAircraftResp,
|
||||
StatsByJumpTypeResp,
|
||||
StatsByGearResp,
|
||||
StatsByYearResp
|
||||
StatsByYearResp,
|
||||
StatsForLastMonthResp,
|
||||
StatsForLastYearResp
|
||||
} from '../models/stats';
|
||||
|
||||
@Injectable()
|
||||
@@ -30,6 +32,9 @@ export class StatsService {
|
||||
resultats.statsByGear = this.getStatsByGear();
|
||||
resultats.statsByYear = this.getStatsByYear();
|
||||
|
||||
resultats.statsForLastYear = this.getStatsOfLastYear();
|
||||
resultats.statsForLastMonth = this.getStatsOfLastMonth();
|
||||
|
||||
return resultats;
|
||||
}
|
||||
|
||||
@@ -97,4 +102,32 @@ export class StatsService {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private getStatsOfLastYear(): Observable<StatsForLastYearResp> {
|
||||
return this.http.get<StatsForLastYearResp>(
|
||||
`${environment.urlApi}/api/Stats/ForLastYear`,
|
||||
{ headers: this.headers }
|
||||
)
|
||||
.pipe(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByDzResp(data));
|
||||
return stats;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private getStatsOfLastMonth(): Observable<StatsForLastMonthResp> {
|
||||
return this.http.get<StatsForLastYearResp>(
|
||||
`${environment.urlApi}/api/Stats/ForLastMonth`,
|
||||
{ headers: this.headers }
|
||||
)
|
||||
.pipe(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByDzResp(data));
|
||||
return stats;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user