fix/little-updates (#1)

Reviewed-on: #1
Co-authored-by: sandre <perso@sebastienandre.com>
Co-committed-by: sandre <perso@sebastienandre.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-01-12 14:25:49 +00:00
committed by sandre
parent 715832d43f
commit ce9d7d89ce
25 changed files with 3745 additions and 3230 deletions

View File

@@ -10,7 +10,7 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build", "preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path. // If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/skydiveLogs-api/bin/Debug/net6.0/skydiveLogs-api.dll", "program": "${workspaceFolder}/skydiveLogs-api/bin/Debug/net8.0/skydiveLogs-api.dll",
"args": [], "args": [],
"cwd": "${workspaceFolder}/skydiveLogs-api", "cwd": "${workspaceFolder}/skydiveLogs-api",
"stopAtEntry": false, "stopAtEntry": false,

View File

@@ -17,6 +17,7 @@ namespace skydiveLogs_api.Domain
ForLastMonthByJumpType = new List<Statistic>(); ForLastMonthByJumpType = new List<Statistic>();
ForLastYearByDz = new List<Statistic>(); ForLastYearByDz = new List<Statistic>();
ForLastYearByJumpType = new List<Statistic>(); ForLastYearByJumpType = new List<Statistic>();
ByYearByJumpType = new List<Statistic>();
} }
#endregion Public Constructors #endregion Public Constructors
@@ -32,6 +33,7 @@ namespace skydiveLogs_api.Domain
public IEnumerable<Statistic> ForLastMonthByJumpType { get; set; } public IEnumerable<Statistic> ForLastMonthByJumpType { get; set; }
public IEnumerable<Statistic> ForLastYearByDz { get; set; } public IEnumerable<Statistic> ForLastYearByDz { get; set; }
public IEnumerable<Statistic> ForLastYearByJumpType { get; set; } public IEnumerable<Statistic> ForLastYearByJumpType { get; set; }
public IEnumerable<Statistic> ByYearByJumpType { get; set; }
public int Id { get; set; } public int Id { get; set; }
public User User { get; set; } public User User { get; set; }

View File

@@ -26,6 +26,9 @@ namespace skydiveLogs_api.DomainBusiness.Interfaces
IEnumerable<Statistic> GetStatsForLastYearByDz(); IEnumerable<Statistic> GetStatsForLastYearByDz();
IEnumerable<Statistic> GetStatsForLastYearByJumpType(); IEnumerable<Statistic> GetStatsForLastYearByJumpType();
IEnumerable<Statistic> GetStatsByYearByJumpType();
void Reset(); void Reset();
#endregion Public Methods #endregion Public Methods

View File

@@ -304,6 +304,34 @@ namespace skydiveLogs_api.DomainBusiness
return allStats.ForLastYearByJumpType; return allStats.ForLastYearByJumpType;
} }
public IEnumerable<Statistic> GetStatsByYearByJumpType()
{
var allStats = GetAllStats();
if (!allStats.ByYearByJumpType.Any())
{
var allJumps = _jumpService.GetAllJumps();
var results = new List<Statistic>();
if (allJumps.Any())
{
results = allJumps.GroupBy(j => new { j.JumpType.Name, j.JumpDate.Year },
j => j,
(groupby, jumps) => new Statistic
{
Label = groupby.Year.ToString(),
Label2 = groupby.Name.ToString(),
Nb = jumps.Count()
})
.ToList();
}
allStats.ByYearByJumpType = results;
_userStatsRepository.Update(allStats);
}
return allStats.ByYearByJumpType;
}
public void Reset() public void Reset()
{ {
var resetStats = new UserStats(); var resetStats = new UserStats();

View File

@@ -10,7 +10,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Runtime.Caching" Version="7.0.0" /> <PackageReference Include="System.Runtime.Caching" Version="9.0.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -10,7 +10,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="LiteDB" Version="5.0.19" /> <PackageReference Include="LiteDB" Version="5.0.21" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -10,8 +10,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -95,6 +95,15 @@ namespace skydiveLogs_api.Controllers
return result; return result;
} }
[HttpGet("ByYearByJumpType")]
[EnableCors]
public IEnumerable<StatisticForChartResp> ByYearByJumpType()
{
var result = _statsService.GetStatsByYearByJumpType();
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
}
[HttpGet("Reset")] [HttpGet("Reset")]
[EnableCors] [EnableCors]
public void Reset() public void Reset()

View File

@@ -18,10 +18,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" /> <PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.10" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.16" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.9" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.11.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,3 +0,0 @@
toto/1totoTOTO2
tata/1tataTATA2
titi/1titiTITI2

View File

@@ -1,31 +1,44 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:7.0.14-bookworm-slim-amd64 AS base # Use the official Microsoft ASP.NET Core image to build the backend
EXPOSE 80 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-backend
WORKDIR "/src/backend"
COPY Back/ .
RUN dotnet restore "skydiveLogs-api/skydiveLogs-api.csproj"
RUN dotnet publish "skydiveLogs-api/skydiveLogs-api.csproj" -c Release -o /app/publish
RUN apt-get -y update # Use the official node image to build the Angular app
RUN apt-get -y install nginx FROM node:20-alpine AS build-frontend
WORKDIR /app
COPY ["Front/skydivelogs-app/package.json", "Front/skydivelogs-app/package-lock.json*", "./"]
RUN npm install
COPY --exclude=Front/skydivelogs-app/node_modules/* Front/skydivelogs-app/ .
RUN npm run build
RUN mkdir -p /app/Front /app/API # Use a .NET runtime image to serve both the backend and frontend
FROM mcr.microsoft.com/dotnet/aspnet:8.0.16-bookworm-slim-amd64 AS final
WORKDIR /app
COPY Front/skydivelogs-app/dist /app/Front # Install nginx
COPY Back/dist /app/API RUN apt-get update && apt-get install -y nginx curl && rm -rf /var/lib/apt/lists/*
RUN rm -f /app/startup.sh # Copy custom nginx configuration
COPY startup.sh /app
RUN chmod 755 /app/startup.sh
RUN update-rc.d nginx defaults
COPY nginx.conf /etc/nginx/sites-available/default COPY nginx.conf /etc/nginx/sites-available/default
# CMD ["service" "nginx" "start;"] RUN rm -rf /usr/share/nginx/html/*
# RUN service nginx restart
VOLUME /app/API/Data # Copy frontend dist folder to nginx html directory
VOLUME /app/Front/config COPY --from=build-frontend /app/dist /usr/share/nginx/html
# Copy backend from the correct build stage
COPY --from=build-backend /app/publish /app
# Expose port 80 for the application
EXPOSE 80
ENV ASPNETCORE_URLS http://+:5001 ENV ASPNETCORE_URLS http://+:5001
# WORKDIR /app/API VOLUME /app/Data
# ENTRYPOINT ["dotnet", "skydiveLogs-api.dll"] VOLUME /usr/share/nginx/html/config
ENTRYPOINT ["sh", "/app/startup.sh"]
# CMD ["sh", "/app/startup.sh"] # Start nginx and the .NET Core app
CMD ["sh", "-c", "dotnet /app/skydiveLogs-api.dll & nginx -g 'daemon off;'"]

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,8 @@
<div> <div>
<table mat-table [dataSource]="dataSourceTable"> <table mat-table [dataSource]="dataSourceTable">
<ng-container matColumnDef="infos"> <ng-container matColumnDef="infos">
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th> <th mat-header-cell *matHeaderCellDef style="min-width: 80px;text-wrap: nowrap;"></th>
<td mat-cell *matCellDef="let element" style="text-align: left;"> <td mat-cell *matCellDef="let element" style="text-align: left;text-wrap: nowrap;">
<mat-icon aria-hidden="false" aria-label="Additional informations of the jump" <mat-icon aria-hidden="false" aria-label="Additional informations of the jump"
style="cursor: pointer;" (click)='openDialog(element, false)'>info</mat-icon> style="cursor: pointer;" (click)='openDialog(element, false)'>info</mat-icon>
<mat-icon aria-hidden="false" aria-label="Special jump" <mat-icon aria-hidden="false" aria-label="Special jump"
@@ -36,9 +36,9 @@
</ng-container> </ng-container>
<ng-container matColumnDef="jumpType"> <ng-container matColumnDef="jumpType">
<th mat-header-cell *matHeaderCellDef style="min-width: 100px;">{{ 'List_Jump_Header_JumpType' | <th mat-header-cell *matHeaderCellDef style="min-width: 100px;text-wrap: nowrap;">{{ 'List_Jump_Header_JumpType' |
translate }}</th> translate }}</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element" style="text-wrap: nowrap;">
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span> <span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span>
</td> </td>
</ng-container> </ng-container>
@@ -64,8 +64,8 @@
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th> <th mat-header-cell *matHeaderCellDef style="min-width: 80px;text-wrap: nowrap;"></th>
<td mat-cell *matCellDef="let element" style="text-align: left;"> <td mat-cell *matCellDef="let element" style="text-align: left;text-wrap: nowrap;">
<mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;" <mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;"
(click)='delete(element)'>delete</mat-icon> (click)='delete(element)'>delete</mat-icon>
<mat-icon aria-hidden="false" aria-label="Update some informations of the jump" <mat-icon aria-hidden="false" aria-label="Update some informations of the jump"

View File

@@ -16,3 +16,9 @@
padding-top: 25px; padding-top: 25px;
} }
.chart-container {
position: relative;
margin: auto;
height: 80vh;
width: 80vw;
}

View File

@@ -1,15 +1,34 @@
<div class="content"> <div class="content">
<div> <div>
<button mat-raised-button color="accent" [routerLink]="['/newTunnelFlight']" [routerLinkActive]="['active']" <button
skipLocationChange>{{ 'ListTunnelFlight_Add' | translate }}</button> mat-raised-button
color="accent"
[routerLink]="['/newTunnelFlight']"
[routerLinkActive]="['active']"
skipLocationChange
>
{{ "ListTunnelFlight_Add" | translate }}
</button>
</div> </div>
<mat-progress-bar [mode]="'indeterminate'" *ngIf="isLoading"></mat-progress-bar> <mat-progress-bar
[mode]="'indeterminate'"
*ngIf="isLoading"
></mat-progress-bar>
<mat-radio-group [(ngModel)]="selectedPeriod" (ngModelChange)="onPeriodChange()"> <mat-radio-group
<mat-radio-button value="currentYear">{{ 'ListTunnelFlight_CurrentYear' | translate }}</mat-radio-button> [(ngModel)]="selectedPeriod"
<mat-radio-button value="12Months">{{ 'ListTunnelFlight_12Months' | translate }}</mat-radio-button> (ngModelChange)="onPeriodChange()"
<mat-radio-button value="all">{{ 'ListTunnelFlight_AllFlights' | translate }}</mat-radio-button> >
<mat-radio-button value="currentYear">{{
"ListTunnelFlight_CurrentYear" | translate
}}</mat-radio-button>
<mat-radio-button value="12Months">{{
"ListTunnelFlight_12Months" | translate
}}</mat-radio-button>
<mat-radio-button value="all">{{
"ListTunnelFlight_AllFlights" | translate
}}</mat-radio-button>
</mat-radio-group> </mat-radio-group>
<mat-nav-list> <mat-nav-list>
@@ -18,20 +37,28 @@
</mat-list-item> </mat-list-item>
</mat-nav-list> </mat-nav-list>
<div style="display: inline-block; position: relative; width: 100%;"> <div class="chart-container">
<canvas baseChart <canvas
baseChart
[data]="barChartData" [data]="barChartData"
[options]="barChartOptions" [options]="barChartOptions"
[plugins]="barChartPlugins" [plugins]="barChartPlugins"
[legend]="barChartLegend" [legend]="barChartLegend"
[type]="barChartType"> [type]="barChartType"
>
</canvas> </canvas>
</div> </div>
<div> <div>
<button mat-raised-button color="accent" (click)="onLoadTable()" >{{ 'ListTunnelFlight_LoadTable' | translate }}</button> <button mat-raised-button color="accent" (click)="onLoadTable()">
{{ "ListTunnelFlight_LoadTable" | translate }}
</button>
<table mat-table [dataSource]="dataSourceTable" *ngIf="dataSourceTable?.data.length"> <table
mat-table
[dataSource]="dataSourceTable"
*ngIf="dataSourceTable?.data.length"
>
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>ID</th> <th mat-header-cell *matHeaderCellDef>ID</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
@@ -42,48 +69,68 @@
<ng-container matColumnDef="tunnel"> <ng-container matColumnDef="tunnel">
<th mat-header-cell *matHeaderCellDef>Tunnel</th> <th mat-header-cell *matHeaderCellDef>Tunnel</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.tunnel.name"></span> <span
class="smallSpanWithBreakWord"
[innerHTML]="element.tunnel.name"
></span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="jumpType"> <ng-container matColumnDef="jumpType">
<th mat-header-cell *matHeaderCellDef>Jump Type</th> <th mat-header-cell *matHeaderCellDef>Jump Type</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span> <span
class="smallSpanWithBreakWord"
[innerHTML]="element.jumpType.name"
></span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="nbMinutes"> <ng-container matColumnDef="nbMinutes">
<th mat-header-cell *matHeaderCellDef>Minutes</th> <th mat-header-cell *matHeaderCellDef>Minutes</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.nbMinutes"></span> <span
class="smallSpanWithBreakWord"
[innerHTML]="element.nbMinutes"
></span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="notes"> <ng-container matColumnDef="notes">
<th mat-header-cell *matHeaderCellDef>Notes</th> <th mat-header-cell *matHeaderCellDef>Notes</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.notes"></span> <span
class="smallSpanWithBreakWord"
[innerHTML]="element.notes"
></span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="flightDate"> <ng-container matColumnDef="flightDate">
<th mat-header-cell *matHeaderCellDef>Date</th> <th mat-header-cell *matHeaderCellDef>Date</th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<span class="smallSpanWithBreakWord" [innerHTML]="element.flightDate | date: 'yyyy-MM-dd'"></span> <span
class="smallSpanWithBreakWord"
[innerHTML]="element.flightDate | date : 'yyyy-MM-dd'"
></span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th> <th mat-header-cell *matHeaderCellDef style="min-width: 80px"></th>
<td mat-cell *matCellDef="let element" style="text-align: left;"> <td mat-cell *matCellDef="let element" style="text-align: left">
<mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;" <mat-icon
(click)='delete(element)'>delete</mat-icon> aria-hidden="false"
aria-label="Delete this jump"
style="cursor: pointer"
(click)="delete(element)"
>delete</mat-icon
>
</td> </td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table> </table>
</div> </div>
</div> </div>

View File

@@ -40,3 +40,10 @@
.contentFlex { .contentFlex {
flex: 45%; flex: 45%;
} }
.chart-container {
position: relative;
margin: auto;
height: 80vh;
width: 80vw;
}

View File

@@ -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,9 +158,25 @@
<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>
<mat-tab label="{{ 'Summary_ByYearByJumpType_Title' | translate }}">
<ng-template matTabContent>
<div class="chart-container">
<canvas
baseChart
[data]="barChartData"
[options]="barChartOptions"
[plugins]="barChartPlugins"
[legend]="barChartLegend"
[type]="barChartType"
>
</canvas>
</div>
</ng-template>
</mat-tab>
</mat-tab-group> </mat-tab-group>
</div> </div>

View File

@@ -1,21 +1,26 @@
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 { ChartConfiguration, ChartData, ChartType, Colors } from "chart.js";
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"],
standalone: false standalone: false,
}) })
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>;
@@ -26,17 +31,30 @@ export class SummaryComponent implements OnInit {
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 displayedColumnsByYearByJumpType: Array<string> = [
"label",
"label2",
"nb",
];
public displayedColumns: Array<string> = ['label', 'nb']; public barChartLegend = true;
public barChartPlugins = [];
public barChartData: ChartData<"line">;
public barChartOptions: ChartConfiguration["options"];
public barChartType: ChartType;
private jumpTypeToColor: Map<string, string>;
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) => {
@@ -46,23 +64,28 @@ 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
);
}); });
this.chartConfig();
} }
public refreshStats() { public refreshStats() {
@@ -73,64 +96,160 @@ 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) => a.label.localeCompare(b.label));
let firstYear: number = Number(data[0].label);
const now = new Date();
const currentYear = now.getFullYear();
const nbYears = currentYear - firstYear;
let listOfYears = new Array(nbYears)
.fill(null)
.map(() => firstYear++);
// Prepare the list of jump type with am empty array
let tmpResults = new Map<string, number[]>();
const listOfJumpType = [...new Set(data.map((obj) => obj.label2))];
listOfJumpType.forEach((type) => {
tmpResults.set(type, new Array(nbYears).fill(NaN));
});
for (let i = 0; i < listOfYears.length; i++) {
const year = listOfYears[i].toString();
let filteredStats = data.filter((d) => d.label == year);
if (filteredStats.length > 0) {
filteredStats.forEach((fs) => {
tmpResults.get(fs.label2)[i] = fs.nb;
});
}
}
const results = [];
tmpResults.forEach((value, key) => {
const color = this.jumpTypeToColor.get(key);
let tmp = {
label: key,
data: value,
backgroundColor: color,
borderColor: color,
pointBackgroundColor: color,
fill: false,
pointRadius: 6,
};
results.push(tmp);
});
this.barChartData = {
labels: listOfYears,
datasets: results,
};
});
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);
); });
}
private chartConfig() {
this.barChartType = "line";
this.barChartOptions = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: true,
},
colors: {
forceOverride: true,
},
},
interaction: {
intersect: false,
mode: "nearest",
axis: "x",
},
scales: {
x: {
stacked: false,
},
y: {
stacked: false,
beginAtZero: true,
},
},
};
this.jumpTypeToColor = new Map<string, string>([
["PAC", "#FFD700"],
["Solo", "#FFA500"],
["RW 3", "#40E0D0"],
["RW 4", "#008080"],
["RW 8", "#7FFFD4"],
["RW X", "#114556"],
["FreeFly", "#FFC0CB"],
["FreeStyle", "#FF91A4"],
["Track/Trace", "#87CEEB"],
["Canopy", "#228B22"],
["Landing accuracy", "#FF6347"],
["Wingsuit 1", "#E6E6FA"],
["Wingsuit 2", "#E0B0FF"],
["Wingsuit 3", "#9400D3"],
]);
} }
} }

View File

@@ -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",

View File

@@ -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",

View File

@@ -12,5 +12,6 @@ export enum CacheApiKey {
StatsOfLastYear, StatsOfLastYear,
StatsOfLastMonth, StatsOfLastMonth,
StatsByYear, StatsByYear,
Tunnel Tunnel,
StatsByYearByJumpType,
} }

View File

@@ -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>();

View File

@@ -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.StatsByYearByJumpType,
callToApi
);
} }
} }

11
TODO.md
View File

@@ -1,11 +0,0 @@
BACK :
- JumpType :
- ajouter l'indication que le type de saut est faisable en tunnel
FRONT :
- JumpType :
- ajouter dans la page un check-box pour indiquer que le type est faisable en tunnel
- permettre de mettre à jour le type sur l'info "en tunnel"
- Tunnel Flight
- la liste de type de vol filter pour ceux concernant par le tunnel
- avec juste 1 date

View File

@@ -4,7 +4,8 @@ server {
server_name _; server_name _;
root /app/Front; #root /app/Front;
root /usr/share/nginx/html;
index index.html; index index.html;
location /api { location /api {