change mvp formula

This commit is contained in:
Tomasi - Developing 2025-01-09 09:47:29 +01:00
parent 9ccfc034da
commit 2e113e5aae
2 changed files with 13 additions and 8 deletions

View File

@ -7,5 +7,6 @@ public class PlayerMvpDto
public long TotalVsDuelPoints { get; set; } public long TotalVsDuelPoints { get; set; }
public int MarshalGuardParticipationCount { get; set; } public int MarshalGuardParticipationCount { get; set; }
public int DesertStormParticipationCount { get; set; } public int DesertStormParticipationCount { get; set; }
public bool IsOldestVsDuelParticipated { get; set; }
public decimal MvpPoints { get; set; } public decimal MvpPoints { get; set; }
} }

View File

@ -55,6 +55,13 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge
.Take(3) .Take(3)
.Sum(vp => vp.WeeklyPoints), .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 MarshalGuardParticipationCount = context.MarshalGuardParticipants
.Count(mpg => mpg.PlayerId == p.Id && mpg.Participated && mpg.MarshalGuard.EventDate > threeWeeksAgo), .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, TotalVsDuelPoints = p.VsDuels,
MarshalGuardParticipationCount = p.MarshalGuardParticipationCount, MarshalGuardParticipationCount = p.MarshalGuardParticipationCount,
DesertStormParticipationCount = p.DessertStormParticipationCount, DesertStormParticipationCount = p.DessertStormParticipationCount,
IsOldestVsDuelParticipated = p.IsOldestVsDuelParticipated,
MvpPoints = Math.Round( MvpPoints = Math.Round(
(decimal)((p.VsDuels / 1000000.0 * 0.7) + (decimal)((p.VsDuels / 1000000.0 * 0.8) +
(p.MarshalGuardParticipationCount * 15) + ((p.MarshalGuardParticipationCount * 20 + p.DessertStormParticipationCount * 40) * 0.2)),2)
(p.DessertStormParticipationCount * 10))
)
}) })
.OrderByDescending(p => p.MvpPoints) .OrderByDescending(p => p.MvpPoints)
.ThenByDescending(p => p.TotalVsDuelPoints) .ThenByDescending(p => p.TotalVsDuelPoints)
@ -116,10 +122,8 @@ public class PlayerRepository(ApplicationContext context, IMapper mapper, ILogge
MarshalGuardParticipationCount = p.MarshalGuardParticipationCount, MarshalGuardParticipationCount = p.MarshalGuardParticipationCount,
DesertStormParticipationCount = p.DessertStormParticipationCount, DesertStormParticipationCount = p.DessertStormParticipationCount,
MvpPoints = Math.Round( MvpPoints = Math.Round(
(decimal)((p.VsDuels / 1000000.0 * 0.7) + (decimal)((p.VsDuels / 1000000.0 * 0.8) +
(p.MarshalGuardParticipationCount * 15) + ((p.MarshalGuardParticipationCount * 20 + p.DessertStormParticipationCount * 40) * 0.2)), 2)
(p.DessertStormParticipationCount * 10))
)
}) })
.OrderByDescending(p => p.MvpPoints) .OrderByDescending(p => p.MvpPoints)
.ThenByDescending(p => p.TotalVsDuelPoints) .ThenByDescending(p => p.TotalVsDuelPoints)