diff --git a/Front/skydivelogs-app/src/app/summary/summary.component.html b/Front/skydivelogs-app/src/app/summary/summary.component.html index a192a1a..5ff34d8 100644 --- a/Front/skydivelogs-app/src/app/summary/summary.component.html +++ b/Front/skydivelogs-app/src/app/summary/summary.component.html @@ -1,52 +1,61 @@
- + : {{ totalJumps }}
- + : {{ totalCutaways }}
- + : {{ lastJump }}
-
- - cached +
+ + cached
- +
- {{ 'Summary_LastMonth_ByDz' | translate }} + {{ "Summary_LastMonth_ByDz" | translate }} - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
- {{ 'Summary_LastMonth_ByJumpType' | translate }} + {{ "Summary_LastMonth_ByJumpType" | translate }} - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
@@ -57,27 +66,27 @@
- {{ 'Summary_LastYear_ByDz' | translate }} + {{ "Summary_LastYear_ByDz" | translate }} - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
- {{ 'Summary_LastYear_ByJumpType' | translate }} + {{ "Summary_LastYear_ByJumpType" | translate }} - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
@@ -88,12 +97,12 @@ - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
@@ -102,12 +111,12 @@ - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
@@ -116,12 +125,12 @@ - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
@@ -130,12 +139,12 @@ - + - + - +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
@@ -144,12 +153,26 @@ - + - + - + +
{{element.label}}{{ element.label }} {{element.nb}}{{ element.nb }}
+
+ + + + + + + + + + + +
{{ element.label }}{{ element.nb }}
diff --git a/Front/skydivelogs-app/src/app/summary/summary.component.ts b/Front/skydivelogs-app/src/app/summary/summary.component.ts index 21a22a5..6678694 100644 --- a/Front/skydivelogs-app/src/app/summary/summary.component.ts +++ b/Front/skydivelogs-app/src/app/summary/summary.component.ts @@ -1,67 +1,77 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import { MatTableDataSource } from '@angular/material/table'; -import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs'; -import { TranslateService } from '@ngx-translate/core'; -import { DatePipe } from '@angular/common'; +import { Component, OnInit, ViewChild } from "@angular/core"; +import { MatTableDataSource } from "@angular/material/table"; +import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs"; +import { TranslateService } from "@ngx-translate/core"; +import { DatePipe } from "@angular/common"; -import { ServiceComm } from '../../services/service-comm.service'; -import { StatsService } from '../../services/stats.service'; -import { StatsByDzResp, StatsByAircraftResp, StatsByGearResp, - StatsByJumpTypeResp, StatsByYearResp } from '../../models/stats'; +import { ServiceComm } from "../../services/service-comm.service"; +import { StatsService } from "../../services/stats.service"; +import { + StatsByDzResp, + StatsByAircraftResp, + StatsByGearResp, + StatsByJumpTypeResp, + StatsByYearResp, +} from "../../models/stats"; @Component({ - selector: 'app-summary', - templateUrl: './summary.component.html', - styleUrls: ['./summary.component.css'] + selector: "app-summary", + templateUrl: "./summary.component.html", + styleUrls: ["./summary.component.css"], }) - export class SummaryComponent implements OnInit { public dsNbJumpByDz: MatTableDataSource; public dsNbJumpByAircraft: MatTableDataSource; public dsNbJumpByGear: MatTableDataSource; public dsNbJumpByType: MatTableDataSource; public dsNbJumpByYear: MatTableDataSource; + public dsNbJumpByYearByJumpType: MatTableDataSource; public dsJumpForLastYearByDz: MatTableDataSource; public dsJumpForLastYearByJumpType: MatTableDataSource; public dsJumpForLastMonthByDz: MatTableDataSource; public dsJumpForLastMonthByJumpType: MatTableDataSource; - public displayedColumns: Array = ['label', 'nb']; + public displayedColumns: Array = ["label", "nb"]; public totalJumps: number; public totalCutaways: number; public lastJump: string; @ViewChild(MatTabGroup) tabGroup: MatTabGroup; - - constructor(private serviceApi: StatsService, - private serviceComm: ServiceComm, - private translateService: TranslateService) { } + + constructor( + private serviceApi: StatsService, + private serviceComm: ServiceComm, + private translateService: TranslateService + ) {} ngOnInit() { - this.serviceComm.forceTranslateTitle.subscribe((data)=> { - if (data === true){ + this.serviceComm.forceTranslateTitle.subscribe((data) => { + if (data === true) { this.updateTitle(); } }); this.updateTitle(); - this.serviceApi.getSimpleSummary() - .subscribe(data => { - this.totalJumps = data.totalJumps; - this.totalCutaways = data.totalCutaways; + this.serviceApi.getSimpleSummary().subscribe((data) => { + this.totalJumps = data.totalJumps; + this.totalCutaways = data.totalCutaways; - const datepipe: DatePipe = new DatePipe('en-US') - let formattedDate = datepipe.transform(data.lastJump.jumpDate, 'EEEE dd MMMM YYYY') - this.lastJump = formattedDate + ' (' + data.lastJump.dropZone.name + ')'; - }); + const datepipe: DatePipe = new DatePipe("en-US"); + let formattedDate = datepipe.transform( + data.lastJump.jumpDate, + "EEEE dd MMMM YYYY" + ); + this.lastJump = formattedDate + " (" + data.lastJump.dropZone.name + ")"; + }); - this.serviceApi.getStatsOfLastMonth() - .subscribe(data => { - data.byDz.sort((a, b) => b.nb - a.nb ); - this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz); - data.byJumpType.sort((a, b) => b.nb - a.nb ); - this.dsJumpForLastMonthByJumpType = new MatTableDataSource(data.byJumpType); - }); + this.serviceApi.getStatsOfLastMonth().subscribe((data) => { + data.byDz.sort((a, b) => b.nb - a.nb); + this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz); + data.byJumpType.sort((a, b) => b.nb - a.nb); + this.dsJumpForLastMonthByJumpType = new MatTableDataSource( + data.byJumpType + ); + }); } public refreshStats() { @@ -72,64 +82,67 @@ export class SummaryComponent implements OnInit { public onTabChanged(event: MatTabChangeEvent) { switch (event.index) { case 0: - this.serviceApi.getStatsOfLastMonth() - .subscribe(data => { - data.byDz.sort((a, b) => b.nb - a.nb ); - this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz); - data.byJumpType.sort((a, b) => b.nb - a.nb ); - this.dsJumpForLastMonthByJumpType = new MatTableDataSource(data.byJumpType); - }); + this.serviceApi.getStatsOfLastMonth().subscribe((data) => { + data.byDz.sort((a, b) => b.nb - a.nb); + this.dsJumpForLastMonthByDz = new MatTableDataSource(data.byDz); + data.byJumpType.sort((a, b) => b.nb - a.nb); + this.dsJumpForLastMonthByJumpType = new MatTableDataSource( + data.byJumpType + ); + }); break; case 1: - this.serviceApi.getStatsOfLastYear() - .subscribe(data => { - data.byDz.sort((a, b) => b.nb - a.nb ); - this.dsJumpForLastYearByDz = new MatTableDataSource(data.byDz); - data.byJumpType.sort((a, b) => b.nb - a.nb ); - this.dsJumpForLastYearByJumpType = new MatTableDataSource(data.byJumpType); - }); + this.serviceApi.getStatsOfLastYear().subscribe((data) => { + data.byDz.sort((a, b) => b.nb - a.nb); + this.dsJumpForLastYearByDz = new MatTableDataSource(data.byDz); + data.byJumpType.sort((a, b) => b.nb - a.nb); + this.dsJumpForLastYearByJumpType = new MatTableDataSource( + data.byJumpType + ); + }); break; case 2: - this.serviceApi.getStatsByDz() - .subscribe(data => { - data.sort((a, b) => b.nb - a.nb); - this.dsNbJumpByDz = new MatTableDataSource(data); - }); + this.serviceApi.getStatsByDz().subscribe((data) => { + data.sort((a, b) => b.nb - a.nb); + this.dsNbJumpByDz = new MatTableDataSource(data); + }); break; case 3: - this.serviceApi.getStatsByAircraft() - .subscribe(data => { - data.sort((a, b) => b.nb - a.nb); - this.dsNbJumpByAircraft = new MatTableDataSource(data); - }); + this.serviceApi.getStatsByAircraft().subscribe((data) => { + data.sort((a, b) => b.nb - a.nb); + this.dsNbJumpByAircraft = new MatTableDataSource(data); + }); break; case 4: - this.serviceApi.getStatsByGear() - .subscribe(data => { - data.sort((a, b) => b.nb - a.nb); - this.dsNbJumpByGear = new MatTableDataSource(data); - }); + this.serviceApi.getStatsByGear().subscribe((data) => { + data.sort((a, b) => b.nb - a.nb); + this.dsNbJumpByGear = new MatTableDataSource(data); + }); break; case 5: - this.serviceApi.getStatsByJumpType() - .subscribe(data => { - data.sort((a, b) => b.nb - a.nb); - this.dsNbJumpByType = new MatTableDataSource(data); - }); + this.serviceApi.getStatsByJumpType().subscribe((data) => { + data.sort((a, b) => b.nb - a.nb); + this.dsNbJumpByType = new MatTableDataSource(data); + }); break; case 6: - this.serviceApi.getStatsByYear() - .subscribe(data => { - data.sort((a, b) => b.label.localeCompare(a.label)); - this.dsNbJumpByYear = new MatTableDataSource(data); - }); + this.serviceApi.getStatsByYear().subscribe((data) => { + data.sort((a, b) => b.label.localeCompare(a.label)); + this.dsNbJumpByYear = new MatTableDataSource(data); + }); + 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() { - this.translateService.get("Summary_Title").subscribe( - data => { this.serviceComm.updatedComponentTitle(data); } - ); + this.translateService.get("Summary_Title").subscribe((data) => { + this.serviceComm.updatedComponentTitle(data); + }); } } diff --git a/Front/skydivelogs-app/src/assets/i18n/en.json b/Front/skydivelogs-app/src/assets/i18n/en.json index ef894f8..2530eb2 100644 --- a/Front/skydivelogs-app/src/assets/i18n/en.json +++ b/Front/skydivelogs-app/src/assets/i18n/en.json @@ -1,133 +1,134 @@ { - "Login_Title" : "Login to the Skydive log", - "Login_Tab_CreateUser" : "Create and login a user", - "Login_Tab_WithUser" : "Login with a user", + "Login_Title": "Login to the Skydive log", + "Login_Tab_CreateUser": "Create and login a user", + "Login_Tab_WithUser": "Login with a user", - "LoginUser_BtnLogin" : "Login", - "LoginUser_PasswordPattern" : "The pattern of the password ([A-Za-z0-9_-] {{ '{' }}8,15{{ '}' }})", - "LoginUser_PasswordRequired" : "Password is required", - "LoginUser_Password" : "Password", - "LoginUser_Username" : "Username", - "LoginUser_UsernamePattern" : "Username must have min 3 characters", - "LoginUser_UsernameRequired" : "Username is required", + "LoginUser_BtnLogin": "Login", + "LoginUser_PasswordPattern": "The pattern of the password ([A-Za-z0-9_-] {{ '{' }}8,15{{ '}' }})", + "LoginUser_PasswordRequired": "Password is required", + "LoginUser_Password": "Password", + "LoginUser_Username": "Username", + "LoginUser_UsernamePattern": "Username must have min 3 characters", + "LoginUser_UsernameRequired": "Username is required", - "LoginCreateUser_Firstname" : "Firstname", - "LoginCreateUser_FirstnameRequired" : "Firstname is required", - "LoginCreateUser_FirstnamePattern" : "Firstname must have min 3 characters", - "LoginCreateUser_Lastname" : "Lastname", - "LoginCreateUser_LastnameRequired" : "Lastname is required", - "LoginCreateUser_LastnamePattern" : "Lastname must have min 3 characters", - "LoginCreateUser_Email" : "E-mail", - "LoginCreateUser_EmailRequired" : "E-mail is required", - "LoginCreateUser_EmailPattern" : "It's not a e-mail", - "LoginCreateUser_Username" : "Username", - "LoginCreateUser_UsernameRequired" : "Username is required", - "LoginCreateUser_UsernamePattern" : "Username must have min 3 characters", - "LoginCreateUser_Password" : "Password", - "LoginCreateUser_PasswordRequired" : "Password is required", - "LoginCreateUser_PasswordPattern" : "The pattern of the password ([A-Za-z0-9_-|/]{{ '{' }}8,15{{ '}' }})", - "LoginCreateUser_BtnLogin" : "Create user and login", + "LoginCreateUser_Firstname": "Firstname", + "LoginCreateUser_FirstnameRequired": "Firstname is required", + "LoginCreateUser_FirstnamePattern": "Firstname must have min 3 characters", + "LoginCreateUser_Lastname": "Lastname", + "LoginCreateUser_LastnameRequired": "Lastname is required", + "LoginCreateUser_LastnamePattern": "Lastname must have min 3 characters", + "LoginCreateUser_Email": "E-mail", + "LoginCreateUser_EmailRequired": "E-mail is required", + "LoginCreateUser_EmailPattern": "It's not a e-mail", + "LoginCreateUser_Username": "Username", + "LoginCreateUser_UsernameRequired": "Username is required", + "LoginCreateUser_UsernamePattern": "Username must have min 3 characters", + "LoginCreateUser_Password": "Password", + "LoginCreateUser_PasswordRequired": "Password is required", + "LoginCreateUser_PasswordPattern": "The pattern of the password ([A-Za-z0-9_-|/]{{ '{' }}8,15{{ '}' }})", + "LoginCreateUser_BtnLogin": "Create user and login", - "Default_Title" : "Home", - "ListDz_Title" : "List of DZs", - "Summary_Title" : "Summary", - "NewJump_Title" : "New jumps", - "ListJumps_Title" : "List of jumps", - "ListJumpTypes_Title" : "List of jump types", - "ListGears_Title" : "List of gears", - "ListAircrafts_Title" : "List of aircrafts", - "NewTunnelFlight_Title" : "New tunnel flights", - "ListTunnelFlight_Title" : "List of hours of tunnel", + "Default_Title": "Home", + "ListDz_Title": "List of DZs", + "Summary_Title": "Summary", + "NewJump_Title": "New jumps", + "ListJumps_Title": "List of jumps", + "ListJumpTypes_Title": "List of jump types", + "ListGears_Title": "List of gears", + "ListAircrafts_Title": "List of aircrafts", + "NewTunnelFlight_Title": "New tunnel flights", + "ListTunnelFlight_Title": "List of hours of tunnel", - "App_Footer" : "Web software to log your skydive jumps - v", - "App_Nav_Summary" : "Summary", - "App_Nav_Jumps" : "List of jumps", - "App_Nav_NewJump" : "Add a new jump", - "App_Nav_Dzs" : "List of DZs", - "App_Nav_Aircrafts" : "List of aircrafts", - "App_Nav_JumpTypes" : "List of jump types", - "App_Nav_Gears" : "List of gears", - "App_Nav_Logout" : "Logout", - "App_Nav_NewTunnelFlight" : "Add tunnel time", - "App_Nav_TunnelFlights": "The tunnel flights", + "App_Footer": "Web software to log your skydive jumps - v", + "App_Nav_Summary": "Summary", + "App_Nav_Jumps": "List of jumps", + "App_Nav_NewJump": "Add a new jump", + "App_Nav_Dzs": "List of DZs", + "App_Nav_Aircrafts": "List of aircrafts", + "App_Nav_JumpTypes": "List of jump types", + "App_Nav_Gears": "List of gears", + "App_Nav_Logout": "Logout", + "App_Nav_NewTunnelFlight": "Add tunnel time", + "App_Nav_TunnelFlights": "The tunnel flights", - "List_Aircrafts_Add" : "Add a aircraft", - "List_Aircrafts_Header_Id" : "ID", - "List_Aircrafts_Header_Name" : "Name", - "List_Aircrafts_Header_Image" : "Image", + "List_Aircrafts_Add": "Add a aircraft", + "List_Aircrafts_Header_Id": "ID", + "List_Aircrafts_Header_Name": "Name", + "List_Aircrafts_Header_Image": "Image", - "List_Gears_Add" : "Add a gear", - "List_Gears_Header_Id" : "ID", - "List_Gears_Header_Name" : "Name", - "List_Gears_Header_Manufacturer" : "Manufacturer", - "List_Gears_Header_CanopySize" : "Canopy size", - "List_Gears_Header_Aad" : "AAD system", - "List_Gears_Header_Main" : "Main canopy", - "List_Gears_Header_Reserve" : "Reserve canopy", + "List_Gears_Add": "Add a gear", + "List_Gears_Header_Id": "ID", + "List_Gears_Header_Name": "Name", + "List_Gears_Header_Manufacturer": "Manufacturer", + "List_Gears_Header_CanopySize": "Canopy size", + "List_Gears_Header_Aad": "AAD system", + "List_Gears_Header_Main": "Main canopy", + "List_Gears_Header_Reserve": "Reserve canopy", - "List_JumpType_Add" : "Add a jump type", - "List_JumpType_Header_Id" : "ID", - "List_JumpType_Header_Name" : "Name", + "List_JumpType_Add": "Add a jump type", + "List_JumpType_Header_Id": "ID", + "List_JumpType_Header_Name": "Name", - "List_Jump_Add" : "Add jumps", - "List_Jump_Header_Num" : "Num", - "List_Jump_Header_Date" : "Date", - "List_Jump_Header_JumpType" : "Jump Type", - "List_Jump_Header_Aircraft" : "Aircraft", - "List_Jump_Header_Dz" : "Drop Zone", - "List_Jump_Header_Gear" : "Gear", + "List_Jump_Add": "Add jumps", + "List_Jump_Header_Num": "Num", + "List_Jump_Header_Date": "Date", + "List_Jump_Header_JumpType": "Jump Type", + "List_Jump_Header_Aircraft": "Aircraft", + "List_Jump_Header_Dz": "Drop Zone", + "List_Jump_Header_Gear": "Gear", - "List_Dz_Add" : "Add a drop zone", - "List_Dz_Header_ID" : "ID", - "List_Dz_Header_Name" : "Name", - "List_Dz_Header_Address" : "Address", - "List_Dz_Header_Type" : "Type", - "List_Dz_Filter" : "Filter", - "List_Dz_Filter_PlaceHolder" : "Filter on the name or address of center", + "List_Dz_Add": "Add a drop zone", + "List_Dz_Header_ID": "ID", + "List_Dz_Header_Name": "Name", + "List_Dz_Header_Address": "Address", + "List_Dz_Header_Type": "Type", + "List_Dz_Filter": "Filter", + "List_Dz_Filter_PlaceHolder": "Filter on the name or address of center", - "Summary_TotalJumps" : "Total jumps", - "Summary_TotalCutaways" : "Total cutaways", - "Summary_LastJump" : "Last jump", - "Summary_Refresh" : "Refresh", - "Summary_LastMonth_Title" : "Jumps in the last month", - "Summary_LastMonth_ByDz" : "By DZ", - "Summary_LastMonth_ByJumpType" : "By jump type", - "Summary_LastYear_Title" : "Jumps in the last year", - "Summary_LastYear_ByDz" : "By DZ", - "Summary_LastYear_ByJumpType" : "By jump type", - "Summary_ByDz_Title" : "By DZ", - "Summary_ByAircraft_Title" : "By aircraft", - "Summary_ByGear_Title" : "By gear", - "Summary_ByJumpType_Title" : "By jump type", - "Summary_ByYear_Title" : "By year", + "Summary_TotalJumps": "Total jumps", + "Summary_TotalCutaways": "Total cutaways", + "Summary_LastJump": "Last jump", + "Summary_Refresh": "Refresh", + "Summary_LastMonth_Title": "Jumps in the last month", + "Summary_LastMonth_ByDz": "By DZ", + "Summary_LastMonth_ByJumpType": "By jump type", + "Summary_LastYear_Title": "Jumps in the last year", + "Summary_LastYear_ByDz": "By DZ", + "Summary_LastYear_ByJumpType": "By jump type", + "Summary_ByDz_Title": "By DZ", + "Summary_ByAircraft_Title": "By aircraft", + "Summary_ByGear_Title": "By gear", + "Summary_ByJumpType_Title": "By jump type", + "Summary_ByYear_Title": "By year", + "Summary_ByYearByJumpType_Title": "By year and by type", - "NewJump_GoToJump" : "View the jumps", - "NewJump_ResetForm" : "Reset form after adding", - "NewJump_ChooseJumpType" : "Choose the jump type", - "NewJump_ChooseAircraft" : "Choose the aircraft", - "NewJump_ChooseDz" : "Choose the DZ", - "NewJump_ChooseGear" : "Choose the used gear", - "NewJump_Cutaway" : "With a cutaway ?", - "NewJump_Special" : "Is a special jump ?", - "NewJump_ExitAlt" : "Exit altitude", - "NewJump_DeployAlt" : "Deploy altitude", - "NewJump_Count" : "Count of jumps", - "NewJump_Comments" : "Comments", - "NewJump_Submit" : "Submit", + "NewJump_GoToJump": "View the jumps", + "NewJump_ResetForm": "Reset form after adding", + "NewJump_ChooseJumpType": "Choose the jump type", + "NewJump_ChooseAircraft": "Choose the aircraft", + "NewJump_ChooseDz": "Choose the DZ", + "NewJump_ChooseGear": "Choose the used gear", + "NewJump_Cutaway": "With a cutaway ?", + "NewJump_Special": "Is a special jump ?", + "NewJump_ExitAlt": "Exit altitude", + "NewJump_DeployAlt": "Deploy altitude", + "NewJump_Count": "Count of jumps", + "NewJump_Comments": "Comments", + "NewJump_Submit": "Submit", - "NewTunnelFlight_ChooseTunnel": "Choose the tunnel", - "NewTunnelFlight_Minutes": "Minutes of the flight", - "NewTunnelFlight_Comments": "Comments", - "NewTunnelFlight_Submit": "Submit", - "NewTunnelFlight_Comments_Lbl": "Comments", - "NewTunnelFlight_Minutes_Lbl": "Time of flight (minutes)", - "NewTunnelFlight_Date_Lbl": "Date of flight", - "NewTunnelFlight_GoToJump": "View the tunnel flights", - "NewTunnelFlight_ChooseJumpType": "Choose the jump type", + "NewTunnelFlight_ChooseTunnel": "Choose the tunnel", + "NewTunnelFlight_Minutes": "Minutes of the flight", + "NewTunnelFlight_Comments": "Comments", + "NewTunnelFlight_Submit": "Submit", + "NewTunnelFlight_Comments_Lbl": "Comments", + "NewTunnelFlight_Minutes_Lbl": "Time of flight (minutes)", + "NewTunnelFlight_Date_Lbl": "Date of flight", + "NewTunnelFlight_GoToJump": "View the tunnel flights", + "NewTunnelFlight_ChooseJumpType": "Choose the jump type", - "ListTunnelFlight_CurrentYear": "On the current year", - "ListTunnelFlight_12Months": "On 12 last months", - "ListTunnelFlight_Add" : "Add tunnel flights", - "ListTunnelFlight_LoadTable" : "Load the tunnel flights", - "ListTunnelFlight_AllFlights" : "All" -} \ No newline at end of file + "ListTunnelFlight_CurrentYear": "On the current year", + "ListTunnelFlight_12Months": "On 12 last months", + "ListTunnelFlight_Add": "Add tunnel flights", + "ListTunnelFlight_LoadTable": "Load the tunnel flights", + "ListTunnelFlight_AllFlights": "All" +} diff --git a/Front/skydivelogs-app/src/assets/i18n/fr.json b/Front/skydivelogs-app/src/assets/i18n/fr.json index 958e2ed..d03cdd1 100644 --- a/Front/skydivelogs-app/src/assets/i18n/fr.json +++ b/Front/skydivelogs-app/src/assets/i18n/fr.json @@ -1,133 +1,134 @@ { - "Login_Title" : "Connexion à Skydive log", - "Login_Tab_CreateUser" : "Créer et se connecter", - "Login_Tab_WithUser" : "Se connecter", + "Login_Title": "Connexion à Skydive log", + "Login_Tab_CreateUser": "Créer et se connecter", + "Login_Tab_WithUser": "Se connecter", - "LoginUser_BtnLogin" : "Connecter", - "LoginUser_PasswordPattern" : "Le mot de passe doit contenir lettres minuscule/majuscule et entre 8 et 15 caractères.", - "LoginUser_PasswordRequired" : "Le mot de passe est obligatoire", - "LoginUser_Password" : "Mot de passe", - "LoginUser_Username" : "Identifiant", - "LoginUser_UsernamePattern" : "L'identifiant doit être minimum de 3 caractères", - "LoginUser_UsernameRequired" : "L'identifiant est obligatoire", + "LoginUser_BtnLogin": "Connecter", + "LoginUser_PasswordPattern": "Le mot de passe doit contenir lettres minuscule/majuscule et entre 8 et 15 caractères.", + "LoginUser_PasswordRequired": "Le mot de passe est obligatoire", + "LoginUser_Password": "Mot de passe", + "LoginUser_Username": "Identifiant", + "LoginUser_UsernamePattern": "L'identifiant doit être minimum de 3 caractères", + "LoginUser_UsernameRequired": "L'identifiant est obligatoire", - "LoginCreateUser_Firstname" : "Prénom", - "LoginCreateUser_FirstnameRequired" : "Le prénom est obligatoire", - "LoginCreateUser_FirstnamePattern" : "Le prénom doit être minimum de 3 caractères", - "LoginCreateUser_Lastname" : "Nom", - "LoginCreateUser_LastnameRequired" : "Le nom est obligatoire", - "LoginCreateUser_LastnamePattern" : "Le nom doit être minimum de 3 caractères", - "LoginCreateUser_Email" : "E-mail", - "LoginCreateUser_EmailRequired" : "E-mail est obligatoire", - "LoginCreateUser_EmailPattern" : "Ceci n'est pas un adresse mail", - "LoginCreateUser_Username" : "Identifiant", - "LoginCreateUser_UsernameRequired" : "L'identifiant est obligatoire", - "LoginCreateUser_UsernamePattern" : "L'identifiant doit être minimum de 3 caractères", - "LoginCreateUser_Password" : "Mot de passe", - "LoginCreateUser_PasswordRequired" : "Le mot de passe est obligatoire", - "LoginCreateUser_PasswordPattern" : "Le mot de passe doit contenir lettres minuscule/majuscule et entre 8 et 15 caractères.", - "LoginCreateUser_BtnLogin" : "Créer et se connecter", + "LoginCreateUser_Firstname": "Prénom", + "LoginCreateUser_FirstnameRequired": "Le prénom est obligatoire", + "LoginCreateUser_FirstnamePattern": "Le prénom doit être minimum de 3 caractères", + "LoginCreateUser_Lastname": "Nom", + "LoginCreateUser_LastnameRequired": "Le nom est obligatoire", + "LoginCreateUser_LastnamePattern": "Le nom doit être minimum de 3 caractères", + "LoginCreateUser_Email": "E-mail", + "LoginCreateUser_EmailRequired": "E-mail est obligatoire", + "LoginCreateUser_EmailPattern": "Ceci n'est pas un adresse mail", + "LoginCreateUser_Username": "Identifiant", + "LoginCreateUser_UsernameRequired": "L'identifiant est obligatoire", + "LoginCreateUser_UsernamePattern": "L'identifiant doit être minimum de 3 caractères", + "LoginCreateUser_Password": "Mot de passe", + "LoginCreateUser_PasswordRequired": "Le mot de passe est obligatoire", + "LoginCreateUser_PasswordPattern": "Le mot de passe doit contenir lettres minuscule/majuscule et entre 8 et 15 caractères.", + "LoginCreateUser_BtnLogin": "Créer et se connecter", - "Default_Title" : "Accueil", - "ListDz_Title" : "Liste des centres de parachutisme", - "Summary_Title" : "Récapitulatif", - "NewJump_Title" : "Nouveaux sauts", - "ListJumps_Title" : "Liste des sauts", - "ListJumpTypes_Title" : "Liste des types de saut", - "ListGears_Title" : "Liste des pièges", - "ListAircrafts_Title" : "Liste des avions", - "NewTunnelFlight_Title" : "Nouveaux créneaux de soufflerie", - "ListTunnelFlight_Title" : "Heures de tunnel", + "Default_Title": "Accueil", + "ListDz_Title": "Liste des centres de parachutisme", + "Summary_Title": "Récapitulatif", + "NewJump_Title": "Nouveaux sauts", + "ListJumps_Title": "Liste des sauts", + "ListJumpTypes_Title": "Liste des types de saut", + "ListGears_Title": "Liste des pièges", + "ListAircrafts_Title": "Liste des avions", + "NewTunnelFlight_Title": "Nouveaux créneaux de soufflerie", + "ListTunnelFlight_Title": "Heures de tunnel", - "App_Footer" : "Application pour enregistrer ses sauts de parachutisme - v", - "App_Nav_Summary" : "Récapitulatif", - "App_Nav_Jumps" : "Les sauts", - "App_Nav_NewJump" : "Ajouter un saut", - "App_Nav_Dzs" : "Centre de parachutisme", - "App_Nav_Aircrafts" : "Avions", - "App_Nav_JumpTypes" : "Type de saut", - "App_Nav_Gears" : "Pièges", - "App_Nav_Logout" : "Se déconnecter", - "App_Nav_NewTunnelFlight" : "Ajouter du temps en tunnel", - "App_Nav_TunnelFlights": "Les vols en soufflerie", + "App_Footer": "Application pour enregistrer ses sauts de parachutisme - v", + "App_Nav_Summary": "Récapitulatif", + "App_Nav_Jumps": "Les sauts", + "App_Nav_NewJump": "Ajouter un saut", + "App_Nav_Dzs": "Centre de parachutisme", + "App_Nav_Aircrafts": "Avions", + "App_Nav_JumpTypes": "Type de saut", + "App_Nav_Gears": "Pièges", + "App_Nav_Logout": "Se déconnecter", + "App_Nav_NewTunnelFlight": "Ajouter du temps en tunnel", + "App_Nav_TunnelFlights": "Les vols en soufflerie", - "List_Aircrafts_Add" : "Ajouter un avion", - "List_Aircrafts_Header_Id" : "ID", - "List_Aircrafts_Header_Name" : "Nom", - "List_Aircrafts_Header_Image" : "Image", + "List_Aircrafts_Add": "Ajouter un avion", + "List_Aircrafts_Header_Id": "ID", + "List_Aircrafts_Header_Name": "Nom", + "List_Aircrafts_Header_Image": "Image", - "List_Gears_Add" : "Ajouter un piège", - "List_Gears_Header_Id" : "ID", - "List_Gears_Header_Name" : "Nom", - "List_Gears_Header_Manufacturer" : "Fabriquant", - "List_Gears_Header_CanopySize" : "Taille de voile", - "List_Gears_Header_Aad" : "Système de sécurité", - "List_Gears_Header_Main" : "Principale", - "List_Gears_Header_Reserve" : "Réserve", + "List_Gears_Add": "Ajouter un piège", + "List_Gears_Header_Id": "ID", + "List_Gears_Header_Name": "Nom", + "List_Gears_Header_Manufacturer": "Fabriquant", + "List_Gears_Header_CanopySize": "Taille de voile", + "List_Gears_Header_Aad": "Système de sécurité", + "List_Gears_Header_Main": "Principale", + "List_Gears_Header_Reserve": "Réserve", - "List_JumpType_Add" : "Ajouter un type de saut", - "List_JumpType_Header_Id" : "ID", - "List_JumpType_Header_Name" : "Nom", + "List_JumpType_Add": "Ajouter un type de saut", + "List_JumpType_Header_Id": "ID", + "List_JumpType_Header_Name": "Nom", - "List_Jump_Add" : "Ajouter des sauts", - "List_Jump_Header_Num" : "Numéro", - "List_Jump_Header_Date" : "Date", - "List_Jump_Header_JumpType" : "Type de saut", - "List_Jump_Header_Aircraft" : "Avion", - "List_Jump_Header_Dz" : "Centre", - "List_Jump_Header_Gear" : "Piège", + "List_Jump_Add": "Ajouter des sauts", + "List_Jump_Header_Num": "Numéro", + "List_Jump_Header_Date": "Date", + "List_Jump_Header_JumpType": "Type de saut", + "List_Jump_Header_Aircraft": "Avion", + "List_Jump_Header_Dz": "Centre", + "List_Jump_Header_Gear": "Piège", - "List_Dz_Add" : "Ajouter un centre de parachutisme", - "List_Dz_Header_ID" : "ID", - "List_Dz_Header_Name" : "Nom", - "List_Dz_Header_Address" : "Adresse", - "List_Dz_Header_Type" : "Type", - "List_Dz_Filter" : "Filtrer", - "List_Dz_Filter_PlaceHolder" : "Filtrer sur le nom ou l'adresse du centre", + "List_Dz_Add": "Ajouter un centre de parachutisme", + "List_Dz_Header_ID": "ID", + "List_Dz_Header_Name": "Nom", + "List_Dz_Header_Address": "Adresse", + "List_Dz_Header_Type": "Type", + "List_Dz_Filter": "Filtrer", + "List_Dz_Filter_PlaceHolder": "Filtrer sur le nom ou l'adresse du centre", - "Summary_TotalJumps" : "Nombre de sauts", - "Summary_TotalCutaways" : "Nombre de libération", - "Summary_LastJump" : "Le dernier saut", - "Summary_Refresh" : "Refresh", - "Summary_LastMonth_Title" : "Les sauts du dernier mois", - "Summary_LastMonth_ByDz" : "Par centre", - "Summary_LastMonth_ByJumpType" : "Par type de saut", - "Summary_LastYear_Title" : "Les sauts de la dernière année", - "Summary_LastYear_ByDz" : "Par centre", - "Summary_LastYear_ByJumpType" : "Par type de saut", - "Summary_ByDz_Title" : "Par centre", - "Summary_ByAircraft_Title" : "Par avion", - "Summary_ByGear_Title" : "Par piège", - "Summary_ByJumpType_Title" : "Par type de saut", - "Summary_ByYear_Title" : "Par an", + "Summary_TotalJumps": "Nombre de sauts", + "Summary_TotalCutaways": "Nombre de libération", + "Summary_LastJump": "Le dernier saut", + "Summary_Refresh": "Refresh", + "Summary_LastMonth_Title": "Les sauts du dernier mois", + "Summary_LastMonth_ByDz": "Par centre", + "Summary_LastMonth_ByJumpType": "Par type de saut", + "Summary_LastYear_Title": "Les sauts de la dernière année", + "Summary_LastYear_ByDz": "Par centre", + "Summary_LastYear_ByJumpType": "Par type de saut", + "Summary_ByDz_Title": "Par centre", + "Summary_ByAircraft_Title": "Par avion", + "Summary_ByGear_Title": "Par piège", + "Summary_ByJumpType_Title": "Par type de saut", + "Summary_ByYear_Title": "Par an", + "Summary_ByYear_Title": "Par an et par type", - "NewJump_GoToJump" : "Voir les sauts", - "NewJump_ResetForm" : "Reset du formulaire après l'ajout", - "NewJump_ChooseJumpType" : "Choisir le type de saut", - "NewJump_ChooseAircraft" : "Choisir l'avion largueur", - "NewJump_ChooseDz" : "Choisir le centre", - "NewJump_ChooseGear" : "Choisir le piège", - "NewJump_Cutaway" : "Libération ?", - "NewJump_Special" : "Saut spécial ?", - "NewJump_ExitAlt" : "Altitude de sortie", - "NewJump_DeployAlt" : "Altitude d'ouverture", - "NewJump_Count" : "Nombre de sauts", - "NewJump_Comments" : "Commentaires", - "NewJump_Submit" : "Ajouter", + "NewJump_GoToJump": "Voir les sauts", + "NewJump_ResetForm": "Reset du formulaire après l'ajout", + "NewJump_ChooseJumpType": "Choisir le type de saut", + "NewJump_ChooseAircraft": "Choisir l'avion largueur", + "NewJump_ChooseDz": "Choisir le centre", + "NewJump_ChooseGear": "Choisir le piège", + "NewJump_Cutaway": "Libération ?", + "NewJump_Special": "Saut spécial ?", + "NewJump_ExitAlt": "Altitude de sortie", + "NewJump_DeployAlt": "Altitude d'ouverture", + "NewJump_Count": "Nombre de sauts", + "NewJump_Comments": "Commentaires", + "NewJump_Submit": "Ajouter", - "NewTunnelFlight_ChooseTunnel": "Choisir le tunnel", - "NewTunnelFlight_Minutes": "Temps de vol(minutes)", - "NewTunnelFlight_Comments": "Commentaires", - "NewTunnelFlight_Submit": "Ajouter", - "NewTunnelFlight_Comments_Lbl": "Commentaires", - "NewTunnelFlight_Minutes_Lbl": "Temps de vol(minutes)", - "NewTunnelFlight_Date_Lbl": "Date des vols", - "NewTunnelFlight_GoToJump": "Voir les temps de vol en soufflerie", - "NewTunnelFlight_ChooseJumpType": "Choisir le type de saut", + "NewTunnelFlight_ChooseTunnel": "Choisir le tunnel", + "NewTunnelFlight_Minutes": "Temps de vol(minutes)", + "NewTunnelFlight_Comments": "Commentaires", + "NewTunnelFlight_Submit": "Ajouter", + "NewTunnelFlight_Comments_Lbl": "Commentaires", + "NewTunnelFlight_Minutes_Lbl": "Temps de vol(minutes)", + "NewTunnelFlight_Date_Lbl": "Date des vols", + "NewTunnelFlight_GoToJump": "Voir les temps de vol en soufflerie", + "NewTunnelFlight_ChooseJumpType": "Choisir le type de saut", - "ListTunnelFlight_CurrentYear": "Dans l'année en cours", - "ListTunnelFlight_12Months": "Sur 12 derniers mois", - "ListTunnelFlight_Add" : "Ajouter du temps en soufflerie", - "ListTunnelFlight_LoadTable" : "Charger les vols en tunnel", - "ListTunnelFlight_AllFlights" : "Tous les vols" -} \ No newline at end of file + "ListTunnelFlight_CurrentYear": "Dans l'année en cours", + "ListTunnelFlight_12Months": "Sur 12 derniers mois", + "ListTunnelFlight_Add": "Ajouter du temps en soufflerie", + "ListTunnelFlight_LoadTable": "Charger les vols en tunnel", + "ListTunnelFlight_AllFlights": "Tous les vols" +} diff --git a/Front/skydivelogs-app/src/models/cache-api-key.enum.ts b/Front/skydivelogs-app/src/models/cache-api-key.enum.ts index 1664ddd..a9e2250 100644 --- a/Front/skydivelogs-app/src/models/cache-api-key.enum.ts +++ b/Front/skydivelogs-app/src/models/cache-api-key.enum.ts @@ -12,5 +12,6 @@ export enum CacheApiKey { StatsOfLastYear, StatsOfLastMonth, StatsByYear, - Tunnel + Tunnel, + StatsByYearByJumpType, } diff --git a/Front/skydivelogs-app/src/models/stats.ts b/Front/skydivelogs-app/src/models/stats.ts index bfc7b33..ea80a65 100644 --- a/Front/skydivelogs-app/src/models/stats.ts +++ b/Front/skydivelogs-app/src/models/stats.ts @@ -1,15 +1,14 @@ -import { Observable } from 'rxjs'; -import { Jump, JumpResp } from './jump'; +import { Observable } from "rxjs"; +import { Jump, JumpResp } from "./jump"; export class StatsResp { public simpleSummary: Observable; - public statsByDz: Observable>; public statsByAircraft: Observable>; public statsByGear: Observable>; public statsByJumpType: Observable>; public statsByYear: Observable>; - + public statsByYearByJumpType: Observable>; public statsForLastYear: Observable; public statsForLastMonth: Observable; } @@ -81,9 +80,21 @@ export class StatsByYearResp { 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 { - constructor(dataByDz: Array, - dataByJumpType: Array) { + constructor( + dataByDz: Array, + dataByJumpType: Array + ) { this.byDz = new Array(); this.byJumpType = new Array(); @@ -96,8 +107,10 @@ export class StatsForLastYearResp { } export class StatsForLastMonthResp { - constructor(dataByDz: Array, - dataByJumpType: Array) { + constructor( + dataByDz: Array, + dataByJumpType: Array + ) { this.byDz = new Array(); this.byJumpType = new Array(); diff --git a/Front/skydivelogs-app/src/services/stats.service.ts b/Front/skydivelogs-app/src/services/stats.service.ts index e8dc5ee..18599f6 100644 --- a/Front/skydivelogs-app/src/services/stats.service.ts +++ b/Front/skydivelogs-app/src/services/stats.service.ts @@ -1,28 +1,38 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { Injectable } from "@angular/core"; +import { HttpClient } from "@angular/common/http"; +import { Observable } from "rxjs"; +import { map } from "rxjs/operators"; -import { StatsByDzResp, StatsByAircraftResp, StatsByJumpTypeResp, - StatsByGearResp, StatsByYearResp, StatsForLastMonthResp, - StatsForLastYearResp, SimpleSummary, SimpleSummaryResp } from '../models/stats'; +import { + StatsByDzResp, + 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 { AircraftService } from "./aircraft.service"; import { JumpTypeService } from "./jump-type.service"; import { GearService } from "./gear.service"; -import { CacheApiKey } from '../models/cache-api-key.enum'; -import { Jump } from '../models/jump'; - +import { CacheApiKey } from "../models/cache-api-key.enum"; +import { Jump } from "../models/jump"; @Injectable() export class StatsService extends BaseService { - constructor(private http: HttpClient, - private dropzoneService: DropzoneService, - private aircraftService: AircraftService, - private jumpTypeService: JumpTypeService, - private gearService: GearService) { + constructor( + private http: HttpClient, + private dropzoneService: DropzoneService, + private aircraftService: AircraftService, + private jumpTypeService: JumpTypeService, + private gearService: GearService + ) { super(); } @@ -35,119 +45,208 @@ export class StatsService extends BaseService { this.serviceCacheApi.delete(CacheApiKey.StatsByYear); this.serviceCacheApi.delete(CacheApiKey.StatsOfLastYear); this.serviceCacheApi.delete(CacheApiKey.StatsOfLastMonth); + this.serviceCacheApi.delete(CacheApiKey.StatsByYearByJumpType); } 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 { - let callToApi = this.http.get(`${this.apiUrl}/Stats/Simple`, { headers: this.headers }) - .pipe(map(response => { - let tmp = new Jump(response.lastJump); - this.dropzoneService.getById(response.lastJump.dropZoneId).subscribe((d)=> tmp.dropZone = 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 callToApi = this.http + .get(`${this.apiUrl}/Stats/Simple`, { + headers: this.headers, + }) + .pipe( + map((response) => { + let tmp = new Jump(response.lastJump); + this.dropzoneService + .getById(response.lastJump.dropZoneId) + .subscribe((d) => (tmp.dropZone = 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); - stats.lastJump = tmp; - return stats; - }) - ); + let stats = new SimpleSummary(response); + stats.lastJump = tmp; + return stats; + }) + ); - return this.serviceCacheApi.get(CacheApiKey.SimpleSummary, callToApi); + return this.serviceCacheApi.get( + CacheApiKey.SimpleSummary, + callToApi + ); } public getStatsByDz(): Observable> { - let callToApi = this.http.get>(`${this.apiUrl}/Stats/ByDz`, { headers: this.headers }) - .pipe( - map(response => { - const stats = response.map(data => new StatsByDzResp(data)); - return stats; - }) - ); + let callToApi = this.http + .get>(`${this.apiUrl}/Stats/ByDz`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const stats = response.map((data) => new StatsByDzResp(data)); + return stats; + }) + ); - return this.serviceCacheApi.get>(CacheApiKey.StatsByDz, callToApi); + return this.serviceCacheApi.get>( + CacheApiKey.StatsByDz, + callToApi + ); } public getStatsByAircraft(): Observable> { - let callToApi = this.http.get>(`${this.apiUrl}/Stats/ByAircraft`, { headers: this.headers }) - .pipe( - map(response => { - const stats = response.map(data => new StatsByAircraftResp(data)); - return stats; - }) - ); + let callToApi = this.http + .get>(`${this.apiUrl}/Stats/ByAircraft`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const stats = response.map((data) => new StatsByAircraftResp(data)); + return stats; + }) + ); - return this.serviceCacheApi.get>(CacheApiKey.StatsByAircraft, callToApi); + return this.serviceCacheApi.get>( + CacheApiKey.StatsByAircraft, + callToApi + ); } public getStatsByJumpType(): Observable> { - let callToApi = this.http.get>(`${this.apiUrl}/Stats/ByJumpType`,{ headers: this.headers }) - .pipe( - map(response => { - const stats = response.map(data => new StatsByJumpTypeResp(data)); - return stats; - }) - ); + let callToApi = this.http + .get>(`${this.apiUrl}/Stats/ByJumpType`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const stats = response.map((data) => new StatsByJumpTypeResp(data)); + return stats; + }) + ); - return this.serviceCacheApi.get>(CacheApiKey.StatsByJumpType, callToApi); + return this.serviceCacheApi.get>( + CacheApiKey.StatsByJumpType, + callToApi + ); } public getStatsByGear(): Observable> { - let callToApi = this.http.get>(`${this.apiUrl}/Stats/ByGear`, { headers: this.headers }) - .pipe( - map(response => { - const stats = response.map(data => new StatsByGearResp(data)); - return stats; - }) - ); + let callToApi = this.http + .get>(`${this.apiUrl}/Stats/ByGear`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const stats = response.map((data) => new StatsByGearResp(data)); + return stats; + }) + ); - return this.serviceCacheApi.get>(CacheApiKey.StatsByGear, callToApi); + return this.serviceCacheApi.get>( + CacheApiKey.StatsByGear, + callToApi + ); } public getStatsByYear(): Observable> { - let callToApi = this.http.get>(`${this.apiUrl}/Stats/ByYear`, { headers: this.headers }) - .pipe( - map(response => { - const stats = response.map(data => new StatsByYearResp(data)); - return stats; - }) - ); + let callToApi = this.http + .get>(`${this.apiUrl}/Stats/ByYear`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const stats = response.map((data) => new StatsByYearResp(data)); + return stats; + }) + ); - return this.serviceCacheApi.get>(CacheApiKey.StatsByYear, callToApi); + return this.serviceCacheApi.get>( + CacheApiKey.StatsByYear, + callToApi + ); } public getStatsOfLastYear(): Observable { - let callToApi = this.http.get(`${this.apiUrl}/Stats/ForLastYear`, { headers: this.headers }) - .pipe( - map(response => { - const statsByDz = response.byDz.map(data => new StatsByDzResp(data)); - const statsByJumpType = response.byJumpType.map( - data => new StatsByDzResp(data) - ); + let callToApi = this.http + .get(`${this.apiUrl}/Stats/ForLastYear`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const statsByDz = response.byDz.map( + (data) => new StatsByDzResp(data) + ); + const statsByJumpType = response.byJumpType.map( + (data) => new StatsByDzResp(data) + ); - return new StatsForLastYearResp(statsByDz, statsByJumpType); - }) - ); + return new StatsForLastYearResp(statsByDz, statsByJumpType); + }) + ); - return this.serviceCacheApi.get(CacheApiKey.StatsOfLastYear, callToApi); + return this.serviceCacheApi.get( + CacheApiKey.StatsOfLastYear, + callToApi + ); } public getStatsOfLastMonth(): Observable { - let callToApi = this.http.get(`${this.apiUrl}/Stats/ForLastMonth`, { headers: this.headers }) - .pipe( - map(response => { - const statsByDz = response.byDz.map(data => new StatsByDzResp(data)); - const statsByJumpType = response.byJumpType.map( - data => new StatsByDzResp(data) - ); + let callToApi = this.http + .get(`${this.apiUrl}/Stats/ForLastMonth`, { + headers: this.headers, + }) + .pipe( + map((response) => { + const statsByDz = response.byDz.map( + (data) => new StatsByDzResp(data) + ); + const statsByJumpType = response.byJumpType.map( + (data) => new StatsByDzResp(data) + ); - return new StatsForLastMonthResp(statsByDz, statsByJumpType); - }) - ); + return new StatsForLastMonthResp(statsByDz, statsByJumpType); + }) + ); - return this.serviceCacheApi.get(CacheApiKey.StatsOfLastMonth, callToApi); + return this.serviceCacheApi.get( + CacheApiKey.StatsOfLastMonth, + callToApi + ); + } + + public getStatsByYearByJumpType(): Observable< + Array + > { + let callToApi = this.http + .get>( + `${this.apiUrl}/Stats/ByYearByJumpType`, + { + headers: this.headers, + } + ) + .pipe( + map((response) => { + const stats = response.map( + (data) => new StatsByYearByJumpTypeResp(data) + ); + return stats; + }) + ); + + return this.serviceCacheApi.get>( + CacheApiKey.StatsByYear, + callToApi + ); } }