diff --git a/Application/DataTransferObjects/Player/PlayerMvpDto.cs b/Application/DataTransferObjects/Player/PlayerMvpDto.cs index 0125f7d..6d8ff8a 100644 --- a/Application/DataTransferObjects/Player/PlayerMvpDto.cs +++ b/Application/DataTransferObjects/Player/PlayerMvpDto.cs @@ -7,5 +7,6 @@ public class PlayerMvpDto public long TotalVsDuelPoints { get; set; } public int MarshalGuardParticipationCount { get; set; } public int DesertStormParticipationCount { get; set; } + public bool IsOldestVsDuelParticipated { get; set; } public decimal MvpPoints { get; set; } } \ No newline at end of file diff --git a/Application/Repositories/PlayerRepository.cs b/Application/Repositories/PlayerRepository.cs index 9be4114..bd5168a 100644 --- a/Application/Repositories/PlayerRepository.cs +++ b/Application/Repositories/PlayerRepository.cs @@ -55,6 +55,13 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge .Take(3) .Sum(vp => vp.WeeklyPoints), + IsOldestVsDuelParticipated = context.VsDuelParticipants + .Where(vp => vp.PlayerId == p.Id && vp.VsDuel.EventDate <= currentDate && !vp.VsDuel.IsInProgress) + .OrderByDescending(vp => vp.VsDuel.EventDate) + .Skip(2) + .Take(1) + .Any(), + MarshalGuardParticipationCount = context.MarshalGuardParticipants .Count(mpg => mpg.PlayerId == p.Id && mpg.Participated && mpg.MarshalGuard.EventDate > threeWeeksAgo), @@ -68,11 +75,10 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge TotalVsDuelPoints = p.VsDuels, MarshalGuardParticipationCount = p.MarshalGuardParticipationCount, DesertStormParticipationCount = p.DessertStormParticipationCount, + IsOldestVsDuelParticipated = p.IsOldestVsDuelParticipated, MvpPoints = Math.Round( - (decimal)((p.VsDuels / 1000000.0 * 0.7) + - (p.MarshalGuardParticipationCount * 15) + - (p.DessertStormParticipationCount * 10)) - ) + (decimal)((p.VsDuels / 1000000.0 * 0.8) + + ((p.MarshalGuardParticipationCount * 20 + p.DessertStormParticipationCount * 40) * 0.2)),2) }) .OrderByDescending(p => p.MvpPoints) .ThenByDescending(p => p.TotalVsDuelPoints) @@ -116,10 +122,8 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge MarshalGuardParticipationCount = p.MarshalGuardParticipationCount, DesertStormParticipationCount = p.DessertStormParticipationCount, MvpPoints = Math.Round( - (decimal)((p.VsDuels / 1000000.0 * 0.7) + - (p.MarshalGuardParticipationCount * 15) + - (p.DessertStormParticipationCount * 10)) - ) + (decimal)((p.VsDuels / 1000000.0 * 0.8) + + ((p.MarshalGuardParticipationCount * 20 + p.DessertStormParticipationCount * 40) * 0.2)), 2) }) .OrderByDescending(p => p.MvpPoints) .ThenByDescending(p => p.TotalVsDuelPoints)