Refacto
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace skydiveLogs_api.DomainBusiness
|
||||
@@ -8,9 +9,29 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsService(IJumpService jumpService)
|
||||
public StatsService(IJumpService jumpService,
|
||||
IStatsByAircraftService statsByAircraftService,
|
||||
IStatsByDzService statsByDzService,
|
||||
IStatsByGearService statsByGearService,
|
||||
IStatsByJumpTypeService statsByJumpTypeService,
|
||||
IStatsByYearByJumpTypeService statsByYearByJumpTypeService,
|
||||
IStatsByYearService statsByYearService,
|
||||
IStatsForLastMonthByDzService statsForLastMonthByDzService,
|
||||
IStatsForLastMonthByJumpTypeService statsForLastMonthByJumpTypeService,
|
||||
IStatsForLastYearByDzService statsForLastYearByDzService,
|
||||
IStatsForLastYearByJumpTypeService statsForLastYearByJumpTypeService)
|
||||
{
|
||||
_jumpService = jumpService;
|
||||
_statsByAircraftService = statsByAircraftService;
|
||||
_statsByDzService = statsByDzService;
|
||||
_statsByGearService = statsByGearService;
|
||||
_statsByJumpTypeService = statsByJumpTypeService;
|
||||
_statsByYearByJumpTypeService = statsByYearByJumpTypeService;
|
||||
_statsByYearService = statsByYearService;
|
||||
_statsForLastMonthByDzService = statsForLastMonthByDzService;
|
||||
_statsForLastMonthByJumpTypeService = statsForLastMonthByJumpTypeService;
|
||||
_statsForLastYearByDzService = statsForLastYearByDzService;
|
||||
_statsForLastYearByJumpTypeService = statsForLastYearByJumpTypeService;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -55,11 +76,122 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
// _userStatsRepository.Update(myStats);
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByAircraft()
|
||||
{
|
||||
var tmp = _statsByAircraftService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.Aircraft,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByDz()
|
||||
{
|
||||
var tmp = _statsByDzService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.DropZone,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByGear()
|
||||
{
|
||||
var tmp = _statsByGearService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.Gear,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByJumpType()
|
||||
{
|
||||
var tmp = _statsByJumpTypeService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.JumpType,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByYear()
|
||||
{
|
||||
var tmp = _statsByYearService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.Year,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastMonthByDz()
|
||||
{
|
||||
var tmp = _statsForLastMonthByDzService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.DropZone,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastMonthByJumpType()
|
||||
{
|
||||
var tmp = _statsForLastMonthByJumpTypeService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.JumpType,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastYearByDz()
|
||||
{
|
||||
var tmp = _statsForLastYearByDzService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.DropZone,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastYearByJumpType()
|
||||
{
|
||||
var tmp = _statsForLastYearByJumpTypeService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.JumpType,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByYearByJumpType()
|
||||
{
|
||||
var tmp = _statsByYearByJumpTypeService.GetStats();
|
||||
return [.. tmp.Select(a => new Statistic
|
||||
{
|
||||
Label = a.Year,
|
||||
Label2 = a.JumpType,
|
||||
Nb = a.Nb
|
||||
})];
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly IJumpService _jumpService;
|
||||
private readonly IStatsByAircraftService _statsByAircraftService;
|
||||
private readonly IStatsByDzService _statsByDzService;
|
||||
private readonly IStatsByGearService _statsByGearService;
|
||||
private readonly IStatsByJumpTypeService _statsByJumpTypeService;
|
||||
private readonly IStatsByYearByJumpTypeService _statsByYearByJumpTypeService;
|
||||
private readonly IStatsByYearService _statsByYearService;
|
||||
private readonly IStatsForLastMonthByDzService _statsForLastMonthByDzService;
|
||||
private readonly IStatsForLastMonthByJumpTypeService _statsForLastMonthByJumpTypeService;
|
||||
private readonly IStatsForLastYearByDzService _statsForLastYearByDzService;
|
||||
private readonly IStatsForLastYearByJumpTypeService _statsForLastYearByJumpTypeService;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user