diff --git a/LaDOSE.Src/LaDOSE.DTO/TournamentDTO.cs b/LaDOSE.Src/LaDOSE.DTO/TournamentDTO.cs index 5941f3e..c2f9c55 100644 --- a/LaDOSE.Src/LaDOSE.DTO/TournamentDTO.cs +++ b/LaDOSE.Src/LaDOSE.DTO/TournamentDTO.cs @@ -35,5 +35,6 @@ namespace LaDOSE.DTO public int Point { get; set; } public int TournamendId { get; set; } public string TournamentUrl { get; set; } + public int Rank { get; set; } } } \ No newline at end of file diff --git a/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs b/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs index d78cb1b..071e897 100644 --- a/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs +++ b/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/TournamentResultViewModel.cs @@ -334,7 +334,7 @@ namespace LaDOSE.DesktopApp.ViewModels $"{game.LongName} ({Results.Results.Count(e => e.GameId == game.Id)} participants) :" + ""); List enumerable = Results.Results.Where(r => r.GameId == game.Id).ToList(); - List top3 = enumerable.OrderByDescending(e => e.Point).Take(3).Select(e => e.Player).ToList(); + List top3 = enumerable.OrderBy(e => e.Rank).Take(3).Select(e => e.Player).ToList(); sb.AppendLine($"
1/ {top3[0]}
2/ {top3[1]}
3/ {top3[2]}

"); sb.AppendLine($"https://challonge.com/fr/{enumerable.First().TournamentUrl}

"); if (columns % 2 == 0) diff --git a/LaDOSE.Src/LaDOSE.Entity/Challonge/TournamentsResult.cs b/LaDOSE.Src/LaDOSE.Entity/Challonge/TournamentsResult.cs index c4aba7b..80d9a72 100644 --- a/LaDOSE.Src/LaDOSE.Entity/Challonge/TournamentsResult.cs +++ b/LaDOSE.Src/LaDOSE.Entity/Challonge/TournamentsResult.cs @@ -14,20 +14,20 @@ namespace LaDOSE.Entity.Challonge public class Result { - public Result(string player, int gameId, int point) : this(player, gameId, 0,"", point) + public Result(string player, int gameId, int point,int rank) : this(player, gameId, 0,"", point,rank) { } - public Result(string player, int gameId, int tournamentdId,string tournamentUrl, int point) + public Result(string player, int gameId, int tournamentdId,string tournamentUrl, int point,int rank) { Player = player; GameId = gameId; Point = point; TournamentUrl = tournamentUrl; TournamentdId = tournamentdId; - + Rank = rank; } @@ -41,5 +41,6 @@ namespace LaDOSE.Entity.Challonge public int GameId { get; set; } public string Player { get; set; } public int Point { get; set; } + public int Rank { get; set; } } } \ No newline at end of file diff --git a/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs b/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs index 844957d..3325664 100644 --- a/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs +++ b/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs @@ -112,18 +112,18 @@ namespace LaDOSE.Business.Service var Top8 = tournament.Participents.Where(p => p.Rank > 4 && p.Rank < 9).ToList(); var Top16 = tournament.Participents.Where(p => p.Rank > 8 && p.Rank <= 16).ToList(); - result.Results.Add(new Result(first.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.FirstPoint)); + result.Results.Add(new Result(first.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.FirstPoint,first.Rank??0)); lesSacs.Remove(first); - result.Results.Add(new Result(second.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.SecondPoint)); + result.Results.Add(new Result(second.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.SecondPoint, second.Rank ?? 0)); lesSacs.Remove(second); thirdFourth.ForEach(r => result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, - currentRule.ThirdFourthPoint))); + currentRule.ThirdFourthPoint, r.Rank ?? 0))); thirdFourth.ForEach(p => lesSacs.Remove(p)); if (currentRule.Top8Point != 0) { Top8.ForEach(r => - result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.Top8Point))); + result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.Top8Point, r.Rank ?? 0))); Top8.ForEach(p => lesSacs.Remove(p)); } @@ -131,13 +131,13 @@ namespace LaDOSE.Business.Service { Top16.ForEach(r => result.Results.Add( - new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.Top16Point))); + new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, currentRule.Top16Point, r.Rank ?? 0))); Top16.ForEach(p => lesSacs.Remove(p)); } lesSacs.ForEach(r => result.Results.Add(new Result(r.Name, tournament.Game.Id, tournament.ChallongeId, tournament.Url, - currentRule.Participation))); + currentRule.Participation, r.Rank ?? 0))); } result.Games = tournaments.Select(e => e.Game).Distinct((game, game1) => game.Name == game1.Name).ToList();