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
|
||||
Reference in New Issue
Block a user