Fix in Stats : add the connectedUser
This commit is contained in:
@@ -10,14 +10,14 @@ namespace skydiveLogs_api.Business
|
||||
{
|
||||
public class StatsService : IStatsService
|
||||
{
|
||||
public StatsService(IJumpRepository jumpRepository)
|
||||
public StatsService(IJumpService jumpService)
|
||||
{
|
||||
_jumpRepository = jumpRepository;
|
||||
_jumpService = jumpService;
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByAircraft()
|
||||
public IEnumerable<Statistic> GetStatsByAircraft(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
return allJumps.GroupBy(j => j.Aircraft.Name,
|
||||
j => j,
|
||||
@@ -29,9 +29,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByDz()
|
||||
public IEnumerable<Statistic> GetStatsByDz(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
return allJumps.GroupBy(j => j.DropZone.Name,
|
||||
j => j,
|
||||
@@ -43,9 +43,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByJumpType()
|
||||
public IEnumerable<Statistic> GetStatsByJumpType(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
return allJumps.GroupBy(j => j.JumpType.Name,
|
||||
j => j,
|
||||
@@ -57,9 +57,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByGear()
|
||||
public IEnumerable<Statistic> GetStatsByGear(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
return allJumps.GroupBy(j => j.Gear.Name,
|
||||
j => j,
|
||||
@@ -71,9 +71,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsByYear()
|
||||
public IEnumerable<Statistic> GetStatsByYear(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
return allJumps.GroupBy(j => j.JumpDate.Year,
|
||||
j => j,
|
||||
@@ -85,9 +85,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastYearByDz()
|
||||
public IEnumerable<Statistic> GetStatsForLastYearByDz(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
var lastJump = allJumps.OrderByDescending(j => j.JumpDate).FirstOrDefault();
|
||||
var yearOfLastJump = lastJump.JumpDate.Year;
|
||||
@@ -103,9 +103,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastYearByJumpType()
|
||||
public IEnumerable<Statistic> GetStatsForLastYearByJumpType(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
var lastJump = allJumps.OrderByDescending(j => j.JumpDate).FirstOrDefault();
|
||||
var yearOfLastJump = lastJump.JumpDate.Year;
|
||||
@@ -121,9 +121,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastMonthByDz()
|
||||
public IEnumerable<Statistic> GetStatsForLastMonthByDz(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
var lastJump = allJumps.OrderByDescending(j => j.JumpDate).FirstOrDefault();
|
||||
var yearOfLastJump = lastJump.JumpDate.Year;
|
||||
@@ -140,9 +140,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Statistic> GetStatsForLastMonthByJumpType()
|
||||
public IEnumerable<Statistic> GetStatsForLastMonthByJumpType(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
var lastJump = allJumps.OrderByDescending(j => j.JumpDate).FirstOrDefault();
|
||||
var yearOfLastJump = lastJump.JumpDate.Year;
|
||||
@@ -159,9 +159,9 @@ namespace skydiveLogs_api.Business
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public SimpleSummary GetSimpleSummary()
|
||||
public SimpleSummary GetSimpleSummary(User connectedUser)
|
||||
{
|
||||
var allJumps = _jumpRepository.GetAll();
|
||||
var allJumps = _jumpService.GetAllJumps(connectedUser);
|
||||
|
||||
var lastJump = allJumps.OrderByDescending(j => j.JumpDate).FirstOrDefault();
|
||||
|
||||
@@ -173,6 +173,6 @@ namespace skydiveLogs_api.Business
|
||||
};
|
||||
}
|
||||
|
||||
private readonly IJumpRepository _jumpRepository;
|
||||
private readonly IJumpService _jumpService;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user