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:
2
Back/.vscode/launch.json
vendored
2
Back/.vscode/launch.json
vendored
@@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// 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": [],
|
||||
"cwd": "${workspaceFolder}/skydiveLogs-api",
|
||||
"stopAtEntry": false,
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace skydiveLogs_api.Domain
|
||||
ForLastMonthByJumpType = new List<Statistic>();
|
||||
ForLastYearByDz = new List<Statistic>();
|
||||
ForLastYearByJumpType = new List<Statistic>();
|
||||
ByYearByJumpType = new List<Statistic>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -32,6 +33,7 @@ namespace skydiveLogs_api.Domain
|
||||
public IEnumerable<Statistic> ForLastMonthByJumpType { get; set; }
|
||||
public IEnumerable<Statistic> ForLastYearByDz { get; set; }
|
||||
public IEnumerable<Statistic> ForLastYearByJumpType { get; set; }
|
||||
public IEnumerable<Statistic> ByYearByJumpType { get; set; }
|
||||
public int Id { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace skydiveLogs_api.DomainBusiness.Interfaces
|
||||
IEnumerable<Statistic> GetStatsForLastYearByDz();
|
||||
|
||||
IEnumerable<Statistic> GetStatsForLastYearByJumpType();
|
||||
|
||||
IEnumerable<Statistic> GetStatsByYearByJumpType();
|
||||
|
||||
void Reset();
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -304,6 +304,34 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
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()
|
||||
{
|
||||
var resetStats = new UserStats();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Runtime.Caching" Version="7.0.0" />
|
||||
<PackageReference Include="System.Runtime.Caching" Version="9.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LiteDB" Version="5.0.19" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.21" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -95,6 +95,15 @@ namespace skydiveLogs_api.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpGet("ByYearByJumpType")]
|
||||
[EnableCors]
|
||||
public IEnumerable<StatisticForChartResp> ByYearByJumpType()
|
||||
{
|
||||
var result = _statsService.GetStatsByYearByJumpType();
|
||||
|
||||
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
|
||||
}
|
||||
|
||||
[HttpGet("Reset")]
|
||||
[EnableCors]
|
||||
public void Reset()
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.10" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.9" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.16" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.11.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
toto/1totoTOTO2
|
||||
tata/1tataTATA2
|
||||
titi/1titiTITI2
|
||||
53
Dockerfile
53
Dockerfile
@@ -1,31 +1,44 @@
|
||||
#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
|
||||
EXPOSE 80
|
||||
# Use the official Microsoft ASP.NET Core image to build the backend
|
||||
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
|
||||
RUN apt-get -y install nginx
|
||||
# Use the official node image to build the Angular app
|
||||
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
|
||||
COPY Back/dist /app/API
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN rm -f /app/startup.sh
|
||||
COPY startup.sh /app
|
||||
RUN chmod 755 /app/startup.sh
|
||||
|
||||
RUN update-rc.d nginx defaults
|
||||
# Copy custom nginx configuration
|
||||
COPY nginx.conf /etc/nginx/sites-available/default
|
||||
# CMD ["service" "nginx" "start;"]
|
||||
# RUN service nginx restart
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
VOLUME /app/API/Data
|
||||
VOLUME /app/Front/config
|
||||
# Copy frontend dist folder to nginx html directory
|
||||
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
|
||||
|
||||
# WORKDIR /app/API
|
||||
# ENTRYPOINT ["dotnet", "skydiveLogs-api.dll"]
|
||||
ENTRYPOINT ["sh", "/app/startup.sh"]
|
||||
# CMD ["sh", "/app/startup.sh"]
|
||||
VOLUME /app/Data
|
||||
VOLUME /usr/share/nginx/html/config
|
||||
|
||||
# Start nginx and the .NET Core app
|
||||
CMD ["sh", "-c", "dotnet /app/skydiveLogs-api.dll & nginx -g 'daemon off;'"]
|
||||
5392
Front/skydivelogs-app/package-lock.json
generated
5392
Front/skydivelogs-app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,8 @@
|
||||
<div>
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="infos">
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th>
|
||||
<td mat-cell *matCellDef="let element" style="text-align: left;">
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;text-wrap: nowrap;"></th>
|
||||
<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"
|
||||
style="cursor: pointer;" (click)='openDialog(element, false)'>info</mat-icon>
|
||||
<mat-icon aria-hidden="false" aria-label="Special jump"
|
||||
@@ -36,9 +36,9 @@
|
||||
</ng-container>
|
||||
|
||||
<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>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<td mat-cell *matCellDef="let element" style="text-wrap: nowrap;">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
@@ -64,8 +64,8 @@
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th>
|
||||
<td mat-cell *matCellDef="let element" style="text-align: left;">
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;text-wrap: nowrap;"></th>
|
||||
<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;"
|
||||
(click)='delete(element)'>delete</mat-icon>
|
||||
<mat-icon aria-hidden="false" aria-label="Update some informations of the jump"
|
||||
|
||||
@@ -16,3 +16,9 @@
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
height: 80vh;
|
||||
width: 80vw;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,34 @@
|
||||
<div class="content">
|
||||
<div>
|
||||
<button mat-raised-button color="accent" [routerLink]="['/newTunnelFlight']" [routerLinkActive]="['active']"
|
||||
skipLocationChange>{{ 'ListTunnelFlight_Add' | translate }}</button>
|
||||
<button
|
||||
mat-raised-button
|
||||
color="accent"
|
||||
[routerLink]="['/newTunnelFlight']"
|
||||
[routerLinkActive]="['active']"
|
||||
skipLocationChange
|
||||
>
|
||||
{{ "ListTunnelFlight_Add" | translate }}
|
||||
</button>
|
||||
</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-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
|
||||
[(ngModel)]="selectedPeriod"
|
||||
(ngModelChange)="onPeriodChange()"
|
||||
>
|
||||
<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-nav-list>
|
||||
@@ -18,20 +37,28 @@
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
|
||||
<div style="display: inline-block; position: relative; width: 100%;">
|
||||
<canvas baseChart
|
||||
<div class="chart-container">
|
||||
<canvas
|
||||
baseChart
|
||||
[data]="barChartData"
|
||||
[options]="barChartOptions"
|
||||
[plugins]="barChartPlugins"
|
||||
[legend]="barChartLegend"
|
||||
[type]="barChartType">
|
||||
[type]="barChartType"
|
||||
>
|
||||
</canvas>
|
||||
</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">
|
||||
<th mat-header-cell *matHeaderCellDef>ID</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
@@ -42,48 +69,68 @@
|
||||
<ng-container matColumnDef="tunnel">
|
||||
<th mat-header-cell *matHeaderCellDef>Tunnel</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.tunnel.name"></span>
|
||||
<span
|
||||
class="smallSpanWithBreakWord"
|
||||
[innerHTML]="element.tunnel.name"
|
||||
></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="jumpType">
|
||||
<th mat-header-cell *matHeaderCellDef>Jump Type</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.jumpType.name"></span>
|
||||
<span
|
||||
class="smallSpanWithBreakWord"
|
||||
[innerHTML]="element.jumpType.name"
|
||||
></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="nbMinutes">
|
||||
<th mat-header-cell *matHeaderCellDef>Minutes</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.nbMinutes"></span>
|
||||
<span
|
||||
class="smallSpanWithBreakWord"
|
||||
[innerHTML]="element.nbMinutes"
|
||||
></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="notes">
|
||||
<th mat-header-cell *matHeaderCellDef>Notes</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span class="smallSpanWithBreakWord" [innerHTML]="element.notes"></span>
|
||||
<span
|
||||
class="smallSpanWithBreakWord"
|
||||
[innerHTML]="element.notes"
|
||||
></span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="flightDate">
|
||||
<th mat-header-cell *matHeaderCellDef>Date</th>
|
||||
<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>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px;"></th>
|
||||
<td mat-cell *matCellDef="let element" style="text-align: left;">
|
||||
<mat-icon aria-hidden="false" aria-label="Delete this jump" style="cursor: pointer;"
|
||||
(click)='delete(element)'>delete</mat-icon>
|
||||
<th mat-header-cell *matHeaderCellDef style="min-width: 80px"></th>
|
||||
<td mat-cell *matCellDef="let element" style="text-align: left">
|
||||
<mat-icon
|
||||
aria-hidden="false"
|
||||
aria-label="Delete this jump"
|
||||
style="cursor: pointer"
|
||||
(click)="delete(element)"
|
||||
>delete</mat-icon
|
||||
>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,3 +40,10 @@
|
||||
.contentFlex {
|
||||
flex: 45%;
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
position: relative;
|
||||
margin: auto;
|
||||
height: 80vh;
|
||||
width: 80vw;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,41 @@
|
||||
<div class="content">
|
||||
<div class="paragraph">
|
||||
<label class="left160">{{ 'Summary_TotalJumps' | translate }}</label>
|
||||
<label class="left160">{{ "Summary_TotalJumps" | translate }}</label>
|
||||
<span>: {{ totalJumps }}</span>
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<label class="left160">{{ 'Summary_TotalCutaways' | translate }}</label>
|
||||
<label class="left160">{{ "Summary_TotalCutaways" | translate }}</label>
|
||||
<span>: {{ totalCutaways }}</span>
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<label class="left160">{{ 'Summary_LastJump' | translate }}</label>
|
||||
<label class="left160">{{ "Summary_LastJump" | translate }}</label>
|
||||
<span>: {{ lastJump }}</span>
|
||||
</div>
|
||||
|
||||
<div class="paragraph" style="margin-top: 20px;">
|
||||
<label class="left160">{{ 'Summary_Refresh' | translate }}</label>
|
||||
<mat-icon aria-hidden="false" aria-label="Force the refresh of the stats" style="cursor: pointer;"
|
||||
(click)='refreshStats()'>cached</mat-icon>
|
||||
<div class="paragraph" style="margin-top: 20px">
|
||||
<label class="left160">{{ "Summary_Refresh" | translate }}</label>
|
||||
<mat-icon
|
||||
aria-hidden="false"
|
||||
aria-label="Force the refresh of the stats"
|
||||
style="cursor: pointer"
|
||||
(click)="refreshStats()"
|
||||
>cached</mat-icon
|
||||
>
|
||||
</div>
|
||||
|
||||
<mat-tab-group mat-align-tabs="left" animationDuration="0ms"
|
||||
(selectedIndex)="0" (selectedTabChange)="onTabChanged($event);">
|
||||
<mat-tab-group
|
||||
mat-align-tabs="left"
|
||||
animationDuration="0ms"
|
||||
(selectedIndex)="(0)"
|
||||
(selectedTabChange)="onTabChanged($event)"
|
||||
>
|
||||
<mat-tab label="{{ 'Summary_LastMonth_Title' | translate }}">
|
||||
<ng-template matTabContent>
|
||||
<div class="containerFlex">
|
||||
<fieldset class="contentFlex">
|
||||
<legend>{{ 'Summary_LastMonth_ByDz' | translate }}</legend>
|
||||
<legend>{{ "Summary_LastMonth_ByDz" | translate }}</legend>
|
||||
<table mat-table [dataSource]="dsJumpForLastMonthByDz">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||
@@ -34,11 +43,11 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="contentFlex">
|
||||
<legend>{{ 'Summary_LastMonth_ByJumpType' | translate }}</legend>
|
||||
<legend>{{ "Summary_LastMonth_ByJumpType" | translate }}</legend>
|
||||
<table mat-table [dataSource]="dsJumpForLastMonthByJumpType">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||
@@ -46,7 +55,7 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -57,7 +66,7 @@
|
||||
<ng-template matTabContent>
|
||||
<div class="containerFlex">
|
||||
<fieldset class="contentFlex">
|
||||
<legend>{{ 'Summary_LastYear_ByDz' | translate }}</legend>
|
||||
<legend>{{ "Summary_LastYear_ByDz" | translate }}</legend>
|
||||
<table mat-table [dataSource]="dsJumpForLastYearByDz">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||
@@ -65,11 +74,11 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="contentFlex">
|
||||
<legend>{{ 'Summary_LastYear_ByJumpType' | translate }}</legend>
|
||||
<legend>{{ "Summary_LastYear_ByJumpType" | translate }}</legend>
|
||||
<table mat-table [dataSource]="dsJumpForLastYearByJumpType">
|
||||
<ng-container matColumnDef="label">
|
||||
<td mat-cell *matCellDef="let element">{{ element.label }}</td>
|
||||
@@ -77,7 +86,7 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -93,7 +102,7 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
@@ -107,7 +116,7 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
@@ -121,7 +130,7 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
@@ -135,7 +144,7 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
@@ -149,9 +158,25 @@
|
||||
<ng-container matColumnDef="nb">
|
||||
<td mat-cell *matCellDef="let element">{{ element.nb }}</td>
|
||||
</ng-container>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="{{ 'Summary_ByYearByJumpType_Title' | translate }}">
|
||||
<ng-template matTabContent>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
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 { ChartConfiguration, ChartData, ChartType, Colors } from "chart.js";
|
||||
|
||||
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'],
|
||||
standalone: false
|
||||
selector: "app-summary",
|
||||
templateUrl: "./summary.component.html",
|
||||
styleUrls: ["./summary.component.css"],
|
||||
standalone: false,
|
||||
})
|
||||
|
||||
export class SummaryComponent implements OnInit {
|
||||
public dsNbJumpByDz: MatTableDataSource<StatsByDzResp>;
|
||||
public dsNbJumpByAircraft: MatTableDataSource<StatsByAircraftResp>;
|
||||
@@ -26,17 +31,30 @@ export class SummaryComponent implements OnInit {
|
||||
public dsJumpForLastYearByJumpType: MatTableDataSource<StatsByJumpTypeResp>;
|
||||
public dsJumpForLastMonthByDz: MatTableDataSource<StatsByDzResp>;
|
||||
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 totalCutaways: number;
|
||||
public lastJump: string;
|
||||
@ViewChild(MatTabGroup) tabGroup: MatTabGroup;
|
||||
|
||||
constructor(private serviceApi: StatsService,
|
||||
constructor(
|
||||
private serviceApi: StatsService,
|
||||
private serviceComm: ServiceComm,
|
||||
private translateService: TranslateService) { }
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
@@ -46,23 +64,28 @@ export class SummaryComponent implements OnInit {
|
||||
});
|
||||
this.updateTitle();
|
||||
|
||||
this.serviceApi.getSimpleSummary()
|
||||
.subscribe(data => {
|
||||
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 => {
|
||||
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.dsJumpForLastMonthByJumpType = new MatTableDataSource(
|
||||
data.byJumpType
|
||||
);
|
||||
});
|
||||
|
||||
this.chartConfig();
|
||||
}
|
||||
|
||||
public refreshStats() {
|
||||
@@ -73,64 +96,160 @@ export class SummaryComponent implements OnInit {
|
||||
public onTabChanged(event: MatTabChangeEvent) {
|
||||
switch (event.index) {
|
||||
case 0:
|
||||
this.serviceApi.getStatsOfLastMonth()
|
||||
.subscribe(data => {
|
||||
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.dsJumpForLastMonthByJumpType = new MatTableDataSource(
|
||||
data.byJumpType
|
||||
);
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
this.serviceApi.getStatsOfLastYear()
|
||||
.subscribe(data => {
|
||||
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.dsJumpForLastYearByJumpType = new MatTableDataSource(
|
||||
data.byJumpType
|
||||
);
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
this.serviceApi.getStatsByDz()
|
||||
.subscribe(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 => {
|
||||
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 => {
|
||||
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 => {
|
||||
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 => {
|
||||
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) => 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() {
|
||||
this.translateService.get("Summary_Title").subscribe(
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
this.translateService.get("Summary_Title").subscribe((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"],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
"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",
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
"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",
|
||||
|
||||
@@ -12,5 +12,6 @@ export enum CacheApiKey {
|
||||
StatsOfLastYear,
|
||||
StatsOfLastMonth,
|
||||
StatsByYear,
|
||||
Tunnel
|
||||
Tunnel,
|
||||
StatsByYearByJumpType,
|
||||
}
|
||||
|
||||
@@ -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<SimpleSummary>;
|
||||
|
||||
public statsByDz: Observable<Array<StatsByDzResp>>;
|
||||
public statsByAircraft: Observable<Array<StatsByAircraftResp>>;
|
||||
public statsByGear: Observable<Array<StatsByGearResp>>;
|
||||
public statsByJumpType: Observable<Array<StatsByJumpTypeResp>>;
|
||||
public statsByYear: Observable<Array<StatsByYearResp>>;
|
||||
|
||||
public statsByYearByJumpType: Observable<Array<StatsByYearByJumpTypeResp>>;
|
||||
public statsForLastYear: Observable<StatsForLastYearResp>;
|
||||
public statsForLastMonth: Observable<StatsForLastMonthResp>;
|
||||
}
|
||||
@@ -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<StatsByDzResp>,
|
||||
dataByJumpType: Array<StatsByJumpTypeResp>) {
|
||||
constructor(
|
||||
dataByDz: Array<StatsByDzResp>,
|
||||
dataByJumpType: Array<StatsByJumpTypeResp>
|
||||
) {
|
||||
this.byDz = new Array<StatsByDzResp>();
|
||||
this.byJumpType = new Array<StatsByJumpTypeResp>();
|
||||
|
||||
@@ -96,8 +107,10 @@ export class StatsForLastYearResp {
|
||||
}
|
||||
|
||||
export class StatsForLastMonthResp {
|
||||
constructor(dataByDz: Array<StatsByDzResp>,
|
||||
dataByJumpType: Array<StatsByJumpTypeResp>) {
|
||||
constructor(
|
||||
dataByDz: Array<StatsByDzResp>,
|
||||
dataByJumpType: Array<StatsByJumpTypeResp>
|
||||
) {
|
||||
this.byDz = new Array<StatsByDzResp>();
|
||||
this.byJumpType = new Array<StatsByJumpTypeResp>();
|
||||
|
||||
|
||||
@@ -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,
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private dropzoneService: DropzoneService,
|
||||
private aircraftService: AircraftService,
|
||||
private jumpTypeService: JumpTypeService,
|
||||
private gearService: GearService) {
|
||||
private gearService: GearService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -35,20 +45,35 @@ 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<SimpleSummary> {
|
||||
let callToApi = this.http.get<SimpleSummaryResp>(`${this.apiUrl}/Stats/Simple`, { headers: this.headers })
|
||||
.pipe(map(response => {
|
||||
let callToApi = this.http
|
||||
.get<SimpleSummaryResp>(`${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 );
|
||||
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;
|
||||
@@ -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>> {
|
||||
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(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByDzResp(data));
|
||||
map((response) => {
|
||||
const stats = response.map((data) => new StatsByDzResp(data));
|
||||
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>> {
|
||||
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(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByAircraftResp(data));
|
||||
map((response) => {
|
||||
const stats = response.map((data) => new StatsByAircraftResp(data));
|
||||
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>> {
|
||||
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(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByJumpTypeResp(data));
|
||||
map((response) => {
|
||||
const stats = response.map((data) => new StatsByJumpTypeResp(data));
|
||||
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>> {
|
||||
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(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByGearResp(data));
|
||||
map((response) => {
|
||||
const stats = response.map((data) => new StatsByGearResp(data));
|
||||
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>> {
|
||||
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(
|
||||
map(response => {
|
||||
const stats = response.map(data => new StatsByYearResp(data));
|
||||
map((response) => {
|
||||
const stats = response.map((data) => new StatsByYearResp(data));
|
||||
return stats;
|
||||
})
|
||||
);
|
||||
|
||||
return this.serviceCacheApi.get<Array<StatsByYearResp>>(CacheApiKey.StatsByYear, callToApi);
|
||||
return this.serviceCacheApi.get<Array<StatsByYearResp>>(
|
||||
CacheApiKey.StatsByYear,
|
||||
callToApi
|
||||
);
|
||||
}
|
||||
|
||||
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(
|
||||
map(response => {
|
||||
const statsByDz = response.byDz.map(data => new StatsByDzResp(data));
|
||||
map((response) => {
|
||||
const statsByDz = response.byDz.map(
|
||||
(data) => new StatsByDzResp(data)
|
||||
);
|
||||
const statsByJumpType = response.byJumpType.map(
|
||||
data => new StatsByDzResp(data)
|
||||
(data) => new StatsByDzResp(data)
|
||||
);
|
||||
|
||||
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> {
|
||||
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(
|
||||
map(response => {
|
||||
const statsByDz = response.byDz.map(data => new StatsByDzResp(data));
|
||||
map((response) => {
|
||||
const statsByDz = response.byDz.map(
|
||||
(data) => new StatsByDzResp(data)
|
||||
);
|
||||
const statsByJumpType = response.byJumpType.map(
|
||||
data => new StatsByDzResp(data)
|
||||
(data) => new StatsByDzResp(data)
|
||||
);
|
||||
|
||||
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
11
TODO.md
@@ -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
|
||||
@@ -4,7 +4,8 @@ server {
|
||||
|
||||
server_name _;
|
||||
|
||||
root /app/Front;
|
||||
#root /app/Front;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location /api {
|
||||
|
||||
Reference in New Issue
Block a user