Update for the tunnel graph to have the stats my month and type of flights
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
|
||||
@@ -56,11 +56,12 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
|
||||
if (allTunnelFlights.Any())
|
||||
{
|
||||
results = allTunnelFlights.GroupBy(j => j.FlightDate.ToString("yy-MM"),
|
||||
results = allTunnelFlights.GroupBy(j => new { FlightDate = j.FlightDate.ToString("yy-MM"), j.JumpType },
|
||||
j => j,
|
||||
(groupby, tunnelFlights) => new Statistic
|
||||
{
|
||||
Label = groupby.ToString(),
|
||||
Label = groupby.FlightDate,
|
||||
Label2 = groupby.JumpType.Name,
|
||||
Nb = tunnelFlights.Sum(t => t.NbMinutes)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace skydiveLogs_api.Controllers
|
||||
// GET: api/TunnelFlight/month/20230101/20230701
|
||||
[HttpGet("month/{beginDate}/{endDate}")]
|
||||
[EnableCors]
|
||||
public IEnumerable<StatisticResp> GetGroupByMonth(string beginDate, string endDate)
|
||||
public IEnumerable<StatisticForChartResp> GetGroupByMonth(string beginDate, string endDate)
|
||||
{
|
||||
var result = _tunnelFlightService.GetTunnelFlightGroupByMonth(beginDate, endDate);
|
||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||
return _mapper.Map<IEnumerable<StatisticForChartResp>>(result);
|
||||
}
|
||||
|
||||
// POST: api/Tunnel
|
||||
|
||||
11
Back/skydiveLogs-api/DataContract/StatisticForChartResp.cs
Normal file
11
Back/skydiveLogs-api/DataContract/StatisticForChartResp.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace skydiveLogs_api.DataContract
|
||||
{
|
||||
public class StatisticForChartResp
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -19,23 +19,26 @@ namespace skydiveLogs_api.Mapper
|
||||
CreateMap<DataContract.ImageReq, UserImage>();
|
||||
CreateMap<DataContract.TunnelFlightReq, TunnelFlight>();
|
||||
|
||||
CreateMap<Gear, DataContract.GearResp>();
|
||||
CreateMap<Jump, DataContract.JumpResp>().ForMember(dest => dest.AircraftId, opt => opt.MapFrom(s => s.Aircraft.Id))
|
||||
.ForMember(dest => dest.DropZoneId, opt => opt.MapFrom(s => s.DropZone.Id))
|
||||
.ForMember(dest => dest.GearId, opt => opt.MapFrom(s => s.Gear.Id))
|
||||
.ForMember(dest => dest.JumpTypeId, opt => opt.MapFrom(s => s.JumpType.Id));
|
||||
CreateMap<TunnelFlight, DataContract.TunnelFlightResp>();
|
||||
|
||||
CreateMap<Gear, DataContract.GearResp>();
|
||||
CreateMap<JumpType, DataContract.JumpTypeResp>();
|
||||
CreateMap<Aircraft, DataContract.AircraftResp>();
|
||||
CreateMap<Aircraft, DataContract.AircraftSimpleResp>();
|
||||
CreateMap<DropZone, DataContract.DropZoneResp>();
|
||||
CreateMap<DropZone, DataContract.DropZoneSimpleResp>();
|
||||
CreateMap<Tunnel, DataContract.TunnelResp>();
|
||||
|
||||
CreateMap<Statistic, DataContract.StatisticResp>();
|
||||
CreateMap<Statistic, DataContract.StatisticForChartResp>();
|
||||
CreateMap<SimpleSummary, DataContract.SimpleSummaryResp>();
|
||||
|
||||
CreateMap<User, DataContract.UserResp>();
|
||||
CreateMap<UserImage, DataContract.ImageResp>();
|
||||
CreateMap<Tunnel, DataContract.TunnelResp>();
|
||||
CreateMap<TunnelFlight, DataContract.TunnelFlightResp>();
|
||||
|
||||
CreateMap<SimpleSummary, DataContract.SimpleSummaryResp>();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
Reference in New Issue
Block a user