Ajout dans la page "Summary" d'un onglet pour avoir les stats "ByYearByJumpType" (début)
This commit is contained in:
@@ -1,32 +1,41 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<label class="left160">{{ 'Summary_TotalJumps' | translate }}</label>
|
<label class="left160">{{ "Summary_TotalJumps" | translate }}</label>
|
||||||
<span>: {{ totalJumps }}</span>
|
<span>: {{ totalJumps }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<label class="left160">{{ 'Summary_TotalCutaways' | translate }}</label>
|
<label class="left160">{{ "Summary_TotalCutaways" | translate }}</label>
|
||||||
<span>: {{ totalCutaways }}</span>
|
<span>: {{ totalCutaways }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="paragraph">
|
<div class="paragraph">
|
||||||
<label class="left160">{{ 'Summary_LastJump' | translate }}</label>
|
<label class="left160">{{ "Summary_LastJump" | translate }}</label>
|
||||||
<span>: {{ lastJump }}</span>
|
<span>: {{ lastJump }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="paragraph" style="margin-top: 20px;">
|
<div class="paragraph" style="margin-top: 20px">
|
||||||
<label class="left160">{{ 'Summary_Refresh' | translate }}</label>
|
<label class="left160">{{ "Summary_Refresh" | translate }}</label>
|
||||||
<mat-icon aria-hidden="false" aria-label="Force the refresh of the stats" style="cursor: pointer;"
|
<mat-icon
|
||||||
(click)='refreshStats()'>cached</mat-icon>
|
aria-hidden="false"
|
||||||
|
aria-label="Force the refresh of the stats"
|
||||||
|
style="cursor: pointer"
|
||||||
|
(click)="refreshStats()"
|
||||||
|
>cached</mat-icon
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-tab-group mat-align-tabs="left" animationDuration="0ms"
|
<mat-tab-group
|
||||||
(selectedIndex)="0" (selectedTabChange)="onTabChanged($event);">
|
mat-align-tabs="left"
|
||||||
|
animationDuration="0ms"
|
||||||
|
(selectedIndex)="(0)"
|
||||||
|
(selectedTabChange)="onTabChanged($event)"
|
||||||
|
>
|
||||||
<mat-tab label="{{ 'Summary_LastMonth_Title' | translate }}">
|
<mat-tab label="{{ 'Summary_LastMonth_Title' | translate }}">
|
||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
<div class="containerFlex">
|
<div class="containerFlex">
|
||||||
<fieldset class="contentFlex">
|
<fieldset class="contentFlex">
|
||||||
<legend>{{ 'Summary_LastMonth_ByDz' | translate }}</legend>
|
<legend>{{ "Summary_LastMonth_ByDz" | translate }}</legend>
|
||||||
<table mat-table [dataSource]="dsJumpForLastMonthByDz">
|
<table mat-table [dataSource]="dsJumpForLastMonthByDz">
|
||||||
<ng-container matColumnDef="label">
|
<ng-container matColumnDef="label">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||||
@@ -34,11 +43,11 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="contentFlex">
|
<fieldset class="contentFlex">
|
||||||
<legend>{{ 'Summary_LastMonth_ByJumpType' | translate }}</legend>
|
<legend>{{ "Summary_LastMonth_ByJumpType" | translate }}</legend>
|
||||||
<table mat-table [dataSource]="dsJumpForLastMonthByJumpType">
|
<table mat-table [dataSource]="dsJumpForLastMonthByJumpType">
|
||||||
<ng-container matColumnDef="label">
|
<ng-container matColumnDef="label">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||||
@@ -46,7 +55,7 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,7 +66,7 @@
|
|||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
<div class="containerFlex">
|
<div class="containerFlex">
|
||||||
<fieldset class="contentFlex">
|
<fieldset class="contentFlex">
|
||||||
<legend>{{ 'Summary_LastYear_ByDz' | translate }}</legend>
|
<legend>{{ "Summary_LastYear_ByDz" | translate }}</legend>
|
||||||
<table mat-table [dataSource]="dsJumpForLastYearByDz">
|
<table mat-table [dataSource]="dsJumpForLastYearByDz">
|
||||||
<ng-container matColumnDef="label">
|
<ng-container matColumnDef="label">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||||
@@ -65,11 +74,11 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="contentFlex">
|
<fieldset class="contentFlex">
|
||||||
<legend>{{ 'Summary_LastYear_ByJumpType' | translate }}</legend>
|
<legend>{{ "Summary_LastYear_ByJumpType" | translate }}</legend>
|
||||||
<table mat-table [dataSource]="dsJumpForLastYearByJumpType">
|
<table mat-table [dataSource]="dsJumpForLastYearByJumpType">
|
||||||
<ng-container matColumnDef="label">
|
<ng-container matColumnDef="label">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||||
@@ -77,7 +86,7 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,7 +102,7 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
@@ -107,7 +116,7 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
@@ -121,7 +130,7 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
@@ -135,7 +144,7 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
@@ -149,7 +158,21 @@
|
|||||||
<ng-container matColumnDef="nb">
|
<ng-container matColumnDef="nb">
|
||||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
|
</table>
|
||||||
|
</ng-template>
|
||||||
|
</mat-tab>
|
||||||
|
|
||||||
|
<mat-tab label="{{ 'Summary_ByYearByJumpType_Title' | translate }}">
|
||||||
|
<ng-template matTabContent>
|
||||||
|
<table mat-table [dataSource]="dsNbJumpByYearByJumpType">
|
||||||
|
<ng-container matColumnDef="label">
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container matColumnDef="nb">
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||||
|
</ng-container>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
</table>
|
</table>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|||||||
@@ -1,41 +1,48 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from "@angular/material/table";
|
||||||
import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs';
|
import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs";
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from "@angular/common";
|
||||||
|
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { StatsService } from '../../services/stats.service';
|
import { StatsService } from "../../services/stats.service";
|
||||||
import { StatsByDzResp, StatsByAircraftResp, StatsByGearResp,
|
import {
|
||||||
StatsByJumpTypeResp, StatsByYearResp } from '../../models/stats';
|
StatsByDzResp,
|
||||||
|
StatsByAircraftResp,
|
||||||
|
StatsByGearResp,
|
||||||
|
StatsByJumpTypeResp,
|
||||||
|
StatsByYearResp,
|
||||||
|
} from "../../models/stats";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-summary',
|
selector: "app-summary",
|
||||||
templateUrl: './summary.component.html',
|
templateUrl: "./summary.component.html",
|
||||||
styleUrls: ['./summary.component.css']
|
styleUrls: ["./summary.component.css"],
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SummaryComponent implements OnInit {
|
export class SummaryComponent implements OnInit {
|
||||||
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
|
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
|
||||||
public dsNbJumpByAircraft: MatTableDataSource<StatsByAircraftResp>;
|
public dsNbJumpByAircraft: MatTableDataSource<StatsByAircraftResp>;
|
||||||
public dsNbJumpByGear: MatTableDataSource<StatsByGearResp>;
|
public dsNbJumpByGear: MatTableDataSource<StatsByGearResp>;
|
||||||
public dsNbJumpByType: MatTableDataSource<StatsByJumpTypeResp>;
|
public dsNbJumpByType: MatTableDataSource<StatsByJumpTypeResp>;
|
||||||
public dsNbJumpByYear: MatTableDataSource<StatsByYearResp>;
|
public dsNbJumpByYear: MatTableDataSource<StatsByYearResp>;
|
||||||
|
public dsNbJumpByYearByJumpType: MatTableDataSource<StatsByYearResp>;
|
||||||
public dsJumpForLastYearByDz: MatTableDataSource<StatsByDzResp>;
|
public dsJumpForLastYearByDz: MatTableDataSource<StatsByDzResp>;
|
||||||
public dsJumpForLastYearByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
|
public dsJumpForLastYearByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
|
||||||
public dsJumpForLastMonthByDz: MatTableDataSource<StatsByDzResp>;
|
public dsJumpForLastMonthByDz: MatTableDataSource<StatsByDzResp>;
|
||||||
public dsJumpForLastMonthByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
|
public dsJumpForLastMonthByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
|
||||||
|
|
||||||
public displayedColumns: Array<string> = ['label', 'nb'];
|
public displayedColumns: Array<string> = ["label", "nb"];
|
||||||
|
|
||||||
public totalJumps: number;
|
public totalJumps: number;
|
||||||
public totalCutaways: number;
|
public totalCutaways: number;
|
||||||
public lastJump: string;
|
public lastJump: string;
|
||||||
@ViewChild(MatTabGroup) tabGroup: MatTabGroup;
|
@ViewChild(MatTabGroup) tabGroup: MatTabGroup;
|
||||||
|
|
||||||
constructor(private serviceApi: StatsService,
|
constructor(
|
||||||
|
private serviceApi: StatsService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
private translateService: TranslateService) { }
|
private translateService: TranslateService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||||
@@ -45,22 +52,25 @@ export class SummaryComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this.updateTitle();
|
this.updateTitle();
|
||||||
|
|
||||||
this.serviceApi.getSimpleSummary()
|
this.serviceApi.getSimpleSummary().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
this.totalJumps = data.totalJumps;
|
this.totalJumps = data.totalJumps;
|
||||||
this.totalCutaways = data.totalCutaways;
|
this.totalCutaways = data.totalCutaways;
|
||||||
|
|
||||||
const datepipe: DatePipe = new DatePipe('en-US')
|
const datepipe: DatePipe = new DatePipe("en-US");
|
||||||
let formattedDate = datepipe.transform(data.lastJump.jumpDate, 'EEEE dd MMMM YYYY')
|
let formattedDate = datepipe.transform(
|
||||||
this.lastJump = formattedDate + ' (' + data.lastJump.dropZone.name + ')';
|
data.lastJump.jumpDate,
|
||||||
|
"EEEE dd MMMM YYYY"
|
||||||
|
);
|
||||||
|
this.lastJump = formattedDate + " (" + data.lastJump.dropZone.name + ")";
|
||||||
});
|
});
|
||||||
|
|
||||||
this.serviceApi.getStatsOfLastMonth()
|
this.serviceApi.getStatsOfLastMonth().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.byDz.sort((a, b) => b.nb - a.nb);
|
data.byDz.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz);
|
this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz);
|
||||||
data.byJumpType.sort((a, b) => b.nb - a.nb);
|
data.byJumpType.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsJumpForLastMonthByJumpType = new MatTableDataSource(data.byJumpType);
|
this.dsJumpForLastMonthByJumpType = new MatTableDataSource(
|
||||||
|
data.byJumpType
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,64 +82,67 @@ export class SummaryComponent implements OnInit {
|
|||||||
public onTabChanged(event: MatTabChangeEvent) {
|
public onTabChanged(event: MatTabChangeEvent) {
|
||||||
switch (event.index) {
|
switch (event.index) {
|
||||||
case 0:
|
case 0:
|
||||||
this.serviceApi.getStatsOfLastMonth()
|
this.serviceApi.getStatsOfLastMonth().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.byDz.sort((a, b) => b.nb - a.nb);
|
data.byDz.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz);
|
this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz);
|
||||||
data.byJumpType.sort((a, b) => b.nb - a.nb);
|
data.byJumpType.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsJumpForLastMonthByJumpType = new MatTableDataSource(data.byJumpType);
|
this.dsJumpForLastMonthByJumpType = new MatTableDataSource(
|
||||||
|
data.byJumpType
|
||||||
|
);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.serviceApi.getStatsOfLastYear()
|
this.serviceApi.getStatsOfLastYear().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.byDz.sort((a, b) => b.nb - a.nb);
|
data.byDz.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsJumpForLastYearByDz = new MatTableDataSource(data.byDz);
|
this.dsJumpForLastYearByDz = new MatTableDataSource(data.byDz);
|
||||||
data.byJumpType.sort((a, b) => b.nb - a.nb);
|
data.byJumpType.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsJumpForLastYearByJumpType = new MatTableDataSource(data.byJumpType);
|
this.dsJumpForLastYearByJumpType = new MatTableDataSource(
|
||||||
|
data.byJumpType
|
||||||
|
);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.serviceApi.getStatsByDz()
|
this.serviceApi.getStatsByDz().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.sort((a, b) => b.nb - a.nb);
|
data.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsNbJumpByDz = new MatTableDataSource(data);
|
this.dsNbJumpByDz = new MatTableDataSource(data);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.serviceApi.getStatsByAircraft()
|
this.serviceApi.getStatsByAircraft().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.sort((a, b) => b.nb - a.nb);
|
data.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsNbJumpByAircraft = new MatTableDataSource(data);
|
this.dsNbJumpByAircraft = new MatTableDataSource(data);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.serviceApi.getStatsByGear()
|
this.serviceApi.getStatsByGear().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.sort((a, b) => b.nb - a.nb);
|
data.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsNbJumpByGear = new MatTableDataSource(data);
|
this.dsNbJumpByGear = new MatTableDataSource(data);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.serviceApi.getStatsByJumpType()
|
this.serviceApi.getStatsByJumpType().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.sort((a, b) => b.nb - a.nb);
|
data.sort((a, b) => b.nb - a.nb);
|
||||||
this.dsNbJumpByType = new MatTableDataSource(data);
|
this.dsNbJumpByType = new MatTableDataSource(data);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
this.serviceApi.getStatsByYear()
|
this.serviceApi.getStatsByYear().subscribe((data) => {
|
||||||
.subscribe(data => {
|
|
||||||
data.sort((a, b) => b.label.localeCompare(a.label));
|
data.sort((a, b) => b.label.localeCompare(a.label));
|
||||||
this.dsNbJumpByYear = new MatTableDataSource(data);
|
this.dsNbJumpByYear = new MatTableDataSource(data);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
this.serviceApi.getStatsByYearByJumpType().subscribe((data) => {
|
||||||
|
data.sort((a, b) => b.label.localeCompare(a.label));
|
||||||
|
this.dsNbJumpByYearByJumpType = new MatTableDataSource(data);
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
this.translateService.get("Summary_Title").subscribe(
|
this.translateService.get("Summary_Title").subscribe((data) => {
|
||||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
this.serviceComm.updatedComponentTitle(data);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
"Summary_ByGear_Title": "By gear",
|
"Summary_ByGear_Title": "By gear",
|
||||||
"Summary_ByJumpType_Title": "By jump type",
|
"Summary_ByJumpType_Title": "By jump type",
|
||||||
"Summary_ByYear_Title": "By year",
|
"Summary_ByYear_Title": "By year",
|
||||||
|
"Summary_ByYearByJumpType_Title": "By year and by type",
|
||||||
|
|
||||||
"NewJump_GoToJump": "View the jumps",
|
"NewJump_GoToJump": "View the jumps",
|
||||||
"NewJump_ResetForm": "Reset form after adding",
|
"NewJump_ResetForm": "Reset form after adding",
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
"Summary_ByGear_Title": "Par piège",
|
"Summary_ByGear_Title": "Par piège",
|
||||||
"Summary_ByJumpType_Title": "Par type de saut",
|
"Summary_ByJumpType_Title": "Par type de saut",
|
||||||
"Summary_ByYear_Title": "Par an",
|
"Summary_ByYear_Title": "Par an",
|
||||||
|
"Summary_ByYear_Title": "Par an et par type",
|
||||||
|
|
||||||
"NewJump_GoToJump": "Voir les sauts",
|
"NewJump_GoToJump": "Voir les sauts",
|
||||||
"NewJump_ResetForm": "Reset du formulaire après l'ajout",
|
"NewJump_ResetForm": "Reset du formulaire après l'ajout",
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ export enum CacheApiKey {
|
|||||||
StatsOfLastYear,
|
StatsOfLastYear,
|
||||||
StatsOfLastMonth,
|
StatsOfLastMonth,
|
||||||
StatsByYear,
|
StatsByYear,
|
||||||
Tunnel
|
Tunnel,
|
||||||
|
StatsByYearByJumpType,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from "rxjs";
|
||||||
import { Jump, JumpResp } from './jump';
|
import { Jump, JumpResp } from "./jump";
|
||||||
|
|
||||||
export class StatsResp {
|
export class StatsResp {
|
||||||
public simpleSummary: Observable<SimpleSummary>;
|
public simpleSummary: Observable<SimpleSummary>;
|
||||||
|
|
||||||
public statsByDz: Observable<Array<StatsByDzResp>>;
|
public statsByDz: Observable<Array<StatsByDzResp>>;
|
||||||
public statsByAircraft: Observable<Array<StatsByAircraftResp>>;
|
public statsByAircraft: Observable<Array<StatsByAircraftResp>>;
|
||||||
public statsByGear: Observable<Array<StatsByGearResp>>;
|
public statsByGear: Observable<Array<StatsByGearResp>>;
|
||||||
public statsByJumpType: Observable<Array<StatsByJumpTypeResp>>;
|
public statsByJumpType: Observable<Array<StatsByJumpTypeResp>>;
|
||||||
public statsByYear: Observable<Array<StatsByYearResp>>;
|
public statsByYear: Observable<Array<StatsByYearResp>>;
|
||||||
|
public statsByYearByJumpType: Observable<Array<StatsByYearByJumpTypeResp>>;
|
||||||
public statsForLastYear: Observable<StatsForLastYearResp>;
|
public statsForLastYear: Observable<StatsForLastYearResp>;
|
||||||
public statsForLastMonth: Observable<StatsForLastMonthResp>;
|
public statsForLastMonth: Observable<StatsForLastMonthResp>;
|
||||||
}
|
}
|
||||||
@@ -81,9 +80,21 @@ export class StatsByYearResp {
|
|||||||
public nb: number;
|
public nb: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class StatsByYearByJumpTypeResp {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public label: string;
|
||||||
|
public label2: string;
|
||||||
|
public nb: number;
|
||||||
|
}
|
||||||
|
|
||||||
export class StatsForLastYearResp {
|
export class StatsForLastYearResp {
|
||||||
constructor(dataByDz: Array<StatsByDzResp>,
|
constructor(
|
||||||
dataByJumpType: Array<StatsByJumpTypeResp>) {
|
dataByDz: Array<StatsByDzResp>,
|
||||||
|
dataByJumpType: Array<StatsByJumpTypeResp>
|
||||||
|
) {
|
||||||
this.byDz = new Array<StatsByDzResp>();
|
this.byDz = new Array<StatsByDzResp>();
|
||||||
this.byJumpType = new Array<StatsByJumpTypeResp>();
|
this.byJumpType = new Array<StatsByJumpTypeResp>();
|
||||||
|
|
||||||
@@ -96,8 +107,10 @@ export class StatsForLastYearResp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class StatsForLastMonthResp {
|
export class StatsForLastMonthResp {
|
||||||
constructor(dataByDz: Array<StatsByDzResp>,
|
constructor(
|
||||||
dataByJumpType: Array<StatsByJumpTypeResp>) {
|
dataByDz: Array<StatsByDzResp>,
|
||||||
|
dataByJumpType: Array<StatsByJumpTypeResp>
|
||||||
|
) {
|
||||||
this.byDz = new Array<StatsByDzResp>();
|
this.byDz = new Array<StatsByDzResp>();
|
||||||
this.byJumpType = new Array<StatsByJumpTypeResp>();
|
this.byJumpType = new Array<StatsByJumpTypeResp>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,38 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from "rxjs";
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from "rxjs/operators";
|
||||||
|
|
||||||
import { StatsByDzResp, StatsByAircraftResp, StatsByJumpTypeResp,
|
import {
|
||||||
StatsByGearResp, StatsByYearResp, StatsForLastMonthResp,
|
StatsByDzResp,
|
||||||
StatsForLastYearResp, SimpleSummary, SimpleSummaryResp } from '../models/stats';
|
StatsByAircraftResp,
|
||||||
|
StatsByJumpTypeResp,
|
||||||
|
StatsByGearResp,
|
||||||
|
StatsByYearResp,
|
||||||
|
StatsByYearByJumpTypeResp,
|
||||||
|
StatsForLastMonthResp,
|
||||||
|
StatsForLastYearResp,
|
||||||
|
SimpleSummary,
|
||||||
|
SimpleSummaryResp,
|
||||||
|
} from "../models/stats";
|
||||||
|
|
||||||
import { BaseService } from './base.service';
|
import { BaseService } from "./base.service";
|
||||||
import { DropzoneService } from "./dropzone.service";
|
import { DropzoneService } from "./dropzone.service";
|
||||||
import { AircraftService } from "./aircraft.service";
|
import { AircraftService } from "./aircraft.service";
|
||||||
import { JumpTypeService } from "./jump-type.service";
|
import { JumpTypeService } from "./jump-type.service";
|
||||||
import { GearService } from "./gear.service";
|
import { GearService } from "./gear.service";
|
||||||
import { CacheApiKey } from '../models/cache-api-key.enum';
|
import { CacheApiKey } from "../models/cache-api-key.enum";
|
||||||
import { Jump } from '../models/jump';
|
import { Jump } from "../models/jump";
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StatsService extends BaseService {
|
export class StatsService extends BaseService {
|
||||||
constructor(private http: HttpClient,
|
constructor(
|
||||||
|
private http: HttpClient,
|
||||||
private dropzoneService: DropzoneService,
|
private dropzoneService: DropzoneService,
|
||||||
private aircraftService: AircraftService,
|
private aircraftService: AircraftService,
|
||||||
private jumpTypeService: JumpTypeService,
|
private jumpTypeService: JumpTypeService,
|
||||||
private gearService: GearService) {
|
private gearService: GearService
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,20 +45,35 @@ export class StatsService extends BaseService {
|
|||||||
this.serviceCacheApi.delete(CacheApiKey.StatsByYear);
|
this.serviceCacheApi.delete(CacheApiKey.StatsByYear);
|
||||||
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastYear);
|
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastYear);
|
||||||
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastMonth);
|
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastMonth);
|
||||||
|
this.serviceCacheApi.delete(CacheApiKey.StatsByYearByJumpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetStats() {
|
public resetStats() {
|
||||||
this.http.get(`${this.apiUrl}/Stats/Reset`, { headers: this.headers }).subscribe();
|
this.http
|
||||||
|
.get(`${this.apiUrl}/Stats/Reset`, { headers: this.headers })
|
||||||
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSimpleSummary(): Observable<SimpleSummary> {
|
public getSimpleSummary(): Observable<SimpleSummary> {
|
||||||
let callToApi = this.http.get<SimpleSummaryResp>(`${this.apiUrl}/Stats/Simple`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
.pipe(map(response => {
|
.get<SimpleSummaryResp>(`${this.apiUrl}/Stats/Simple`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
|
.pipe(
|
||||||
|
map((response) => {
|
||||||
let tmp = new Jump(response.lastJump);
|
let tmp = new Jump(response.lastJump);
|
||||||
this.dropzoneService.getById(response.lastJump.dropZoneId).subscribe((d)=> tmp.dropZone = d );
|
this.dropzoneService
|
||||||
this.aircraftService.getById(response.lastJump.aircraftId).subscribe((d)=> tmp.aircraft = d );
|
.getById(response.lastJump.dropZoneId)
|
||||||
this.jumpTypeService.getById(response.lastJump.jumpTypeId).subscribe((d)=> tmp.jumpType = d );
|
.subscribe((d) => (tmp.dropZone = d));
|
||||||
this.gearService.getById(response.lastJump.gearId).subscribe((d)=> tmp.gear = d );
|
this.aircraftService
|
||||||
|
.getById(response.lastJump.aircraftId)
|
||||||
|
.subscribe((d) => (tmp.aircraft = d));
|
||||||
|
this.jumpTypeService
|
||||||
|
.getById(response.lastJump.jumpTypeId)
|
||||||
|
.subscribe((d) => (tmp.jumpType = d));
|
||||||
|
this.gearService
|
||||||
|
.getById(response.lastJump.gearId)
|
||||||
|
.subscribe((d) => (tmp.gear = d));
|
||||||
|
|
||||||
let stats = new SimpleSummary(response);
|
let stats = new SimpleSummary(response);
|
||||||
stats.lastJump = tmp;
|
stats.lastJump = tmp;
|
||||||
@@ -56,98 +81,172 @@ export class StatsService extends BaseService {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<SimpleSummary>(CacheApiKey.SimpleSummary, callToApi);
|
return this.serviceCacheApi.get<SimpleSummary>(
|
||||||
|
CacheApiKey.SimpleSummary,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsByDz(): Observable<Array<StatsByDzResp>> {
|
public getStatsByDz(): Observable<Array<StatsByDzResp>> {
|
||||||
let callToApi = this.http.get<Array<StatsByDzResp>>(`${this.apiUrl}/Stats/ByDz`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<Array<StatsByDzResp>>(`${this.apiUrl}/Stats/ByDz`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const stats = response.map(data => new StatsByDzResp(data));
|
const stats = response.map((data) => new StatsByDzResp(data));
|
||||||
return stats;
|
return stats;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<Array<StatsByDzResp>>(CacheApiKey.StatsByDz, callToApi);
|
return this.serviceCacheApi.get<Array<StatsByDzResp>>(
|
||||||
|
CacheApiKey.StatsByDz,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsByAircraft(): Observable<Array<StatsByAircraftResp>> {
|
public getStatsByAircraft(): Observable<Array<StatsByAircraftResp>> {
|
||||||
let callToApi = this.http.get<Array<StatsByAircraftResp>>(`${this.apiUrl}/Stats/ByAircraft`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<Array<StatsByAircraftResp>>(`${this.apiUrl}/Stats/ByAircraft`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const stats = response.map(data => new StatsByAircraftResp(data));
|
const stats = response.map((data) => new StatsByAircraftResp(data));
|
||||||
return stats;
|
return stats;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<Array<StatsByAircraftResp>>(CacheApiKey.StatsByAircraft, callToApi);
|
return this.serviceCacheApi.get<Array<StatsByAircraftResp>>(
|
||||||
|
CacheApiKey.StatsByAircraft,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsByJumpType(): Observable<Array<StatsByJumpTypeResp>> {
|
public getStatsByJumpType(): Observable<Array<StatsByJumpTypeResp>> {
|
||||||
let callToApi = this.http.get<Array<StatsByJumpTypeResp>>(`${this.apiUrl}/Stats/ByJumpType`,{ headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<Array<StatsByJumpTypeResp>>(`${this.apiUrl}/Stats/ByJumpType`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const stats = response.map(data => new StatsByJumpTypeResp(data));
|
const stats = response.map((data) => new StatsByJumpTypeResp(data));
|
||||||
return stats;
|
return stats;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<Array<StatsByJumpTypeResp>>(CacheApiKey.StatsByJumpType, callToApi);
|
return this.serviceCacheApi.get<Array<StatsByJumpTypeResp>>(
|
||||||
|
CacheApiKey.StatsByJumpType,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsByGear(): Observable<Array<StatsByGearResp>> {
|
public getStatsByGear(): Observable<Array<StatsByGearResp>> {
|
||||||
let callToApi = this.http.get<Array<StatsByGearResp>>(`${this.apiUrl}/Stats/ByGear`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<Array<StatsByGearResp>>(`${this.apiUrl}/Stats/ByGear`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const stats = response.map(data => new StatsByGearResp(data));
|
const stats = response.map((data) => new StatsByGearResp(data));
|
||||||
return stats;
|
return stats;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<Array<StatsByGearResp>>(CacheApiKey.StatsByGear, callToApi);
|
return this.serviceCacheApi.get<Array<StatsByGearResp>>(
|
||||||
|
CacheApiKey.StatsByGear,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsByYear(): Observable<Array<StatsByYearResp>> {
|
public getStatsByYear(): Observable<Array<StatsByYearResp>> {
|
||||||
let callToApi = this.http.get<Array<StatsByYearResp>>(`${this.apiUrl}/Stats/ByYear`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<Array<StatsByYearResp>>(`${this.apiUrl}/Stats/ByYear`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const stats = response.map(data => new StatsByYearResp(data));
|
const stats = response.map((data) => new StatsByYearResp(data));
|
||||||
return stats;
|
return stats;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<Array<StatsByYearResp>>(CacheApiKey.StatsByYear, callToApi);
|
return this.serviceCacheApi.get<Array<StatsByYearResp>>(
|
||||||
|
CacheApiKey.StatsByYear,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsOfLastYear(): Observable<StatsForLastYearResp> {
|
public getStatsOfLastYear(): Observable<StatsForLastYearResp> {
|
||||||
let callToApi = this.http.get<StatsForLastYearResp>(`${this.apiUrl}/Stats/ForLastYear`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<StatsForLastYearResp>(`${this.apiUrl}/Stats/ForLastYear`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const statsByDz = response.byDz.map(data => new StatsByDzResp(data));
|
const statsByDz = response.byDz.map(
|
||||||
|
(data) => new StatsByDzResp(data)
|
||||||
|
);
|
||||||
const statsByJumpType = response.byJumpType.map(
|
const statsByJumpType = response.byJumpType.map(
|
||||||
data => new StatsByDzResp(data)
|
(data) => new StatsByDzResp(data)
|
||||||
);
|
);
|
||||||
|
|
||||||
return new StatsForLastYearResp(statsByDz, statsByJumpType);
|
return new StatsForLastYearResp(statsByDz, statsByJumpType);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<StatsForLastYearResp>(CacheApiKey.StatsOfLastYear, callToApi);
|
return this.serviceCacheApi.get<StatsForLastYearResp>(
|
||||||
|
CacheApiKey.StatsOfLastYear,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getStatsOfLastMonth(): Observable<StatsForLastMonthResp> {
|
public getStatsOfLastMonth(): Observable<StatsForLastMonthResp> {
|
||||||
let callToApi = this.http.get<StatsForLastYearResp>(`${this.apiUrl}/Stats/ForLastMonth`, { headers: this.headers })
|
let callToApi = this.http
|
||||||
|
.get<StatsForLastYearResp>(`${this.apiUrl}/Stats/ForLastMonth`, {
|
||||||
|
headers: this.headers,
|
||||||
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map((response) => {
|
||||||
const statsByDz = response.byDz.map(data => new StatsByDzResp(data));
|
const statsByDz = response.byDz.map(
|
||||||
|
(data) => new StatsByDzResp(data)
|
||||||
|
);
|
||||||
const statsByJumpType = response.byJumpType.map(
|
const statsByJumpType = response.byJumpType.map(
|
||||||
data => new StatsByDzResp(data)
|
(data) => new StatsByDzResp(data)
|
||||||
);
|
);
|
||||||
|
|
||||||
return new StatsForLastMonthResp(statsByDz, statsByJumpType);
|
return new StatsForLastMonthResp(statsByDz, statsByJumpType);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return this.serviceCacheApi.get<StatsForLastMonthResp>(CacheApiKey.StatsOfLastMonth, callToApi);
|
return this.serviceCacheApi.get<StatsForLastMonthResp>(
|
||||||
|
CacheApiKey.StatsOfLastMonth,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getStatsByYearByJumpType(): Observable<
|
||||||
|
Array<StatsByYearByJumpTypeResp>
|
||||||
|
> {
|
||||||
|
let callToApi = this.http
|
||||||
|
.get<Array<StatsByYearByJumpTypeResp>>(
|
||||||
|
`${this.apiUrl}/Stats/ByYearByJumpType`,
|
||||||
|
{
|
||||||
|
headers: this.headers,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
map((response) => {
|
||||||
|
const stats = response.map(
|
||||||
|
(data) => new StatsByYearByJumpTypeResp(data)
|
||||||
|
);
|
||||||
|
return stats;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
return this.serviceCacheApi.get<Array<StatsByYearByJumpTypeResp>>(
|
||||||
|
CacheApiKey.StatsByYear,
|
||||||
|
callToApi
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user