From af79011d14c126d00cab83dfc3ba3aed8d90b212 Mon Sep 17 00:00:00 2001 From: Darkstack <1835601+darkstack@users.noreply.github.com> Date: Thu, 30 May 2019 01:45:56 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20l'algorithme=20pour=20g=C3=A9rer?= =?UTF-8?q?=20les=20sacs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/TournamentResultView.xaml | 38 +++++++++---------- .../Provider/ChallongeProvider.cs | 19 +++++++--- .../Service/TournamentService.cs | 16 ++++++++ 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml b/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml index b08f652..8175c4e 100644 --- a/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml +++ b/LaDOSE.Src/LaDOSE.DesktopApp/Views/TournamentResultView.xaml @@ -83,28 +83,26 @@ - - Resultat : - - First : - + + + + Total : + - - Result : - - - - - - - - - + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs b/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs index 6fc9d9a..fe7d091 100644 --- a/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs +++ b/LaDOSE.Src/LaDOSE.Service/Provider/ChallongeProvider.cs @@ -73,13 +73,20 @@ namespace LaDOSE.Business.Provider var participentResults = await new ParticipantsQuery(){tournamentID = idTournament }.call(ApiCaller); List participants = new List(); - participentResults.ForEach(w => participants.Add(new Participent() + participentResults.ForEach(w => { - Id = w.id, - Name = w.name, - Rank = w.final_rank, - IsMember = true, - })); + if (w.active) + { + participants.Add(new Participent() + { + Id = w.id, + Name = w.name, + Rank = w.final_rank, + IsMember = false, + }); + } + + }); return participants; } diff --git a/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs b/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs index 0f1b2e2..8f7d052 100644 --- a/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs +++ b/LaDOSE.Src/LaDOSE.Service/Service/TournamentService.cs @@ -22,6 +22,8 @@ namespace LaDOSE.Business.Service public int Top8Point { get; set; } public int Top16Point { get; set; } + public int Participation => 1; + public Rules(int playerMin, int playerMax, int firstPoint, int secondPoint, int thirdFourthPoint, int top8Point, int top16Point) { PlayerMin = playerMin; @@ -31,6 +33,7 @@ namespace LaDOSE.Business.Service ThirdFourthPoint = thirdFourthPoint; Top8Point = top8Point; Top16Point = top16Point; + } } @@ -97,6 +100,10 @@ namespace LaDOSE.Business.Service tournament.Game = game; var playerCount = tournament.Participents.Count; + //Suppression des forfait + + + var lesSacs = tournament.Participents; var currentRule = TournamentRules.FirstOrDefault(rules => rules.PlayerMin < playerCount && rules.PlayerMax >= playerCount ); @@ -112,10 +119,19 @@ namespace LaDOSE.Business.Service var Top16 = tournament.Participents.Where(p => p.Rank >9 && p.Rank<=16).ToList(); result.Results.Add(new Result(first.Name,tournament.Game.Id,currentRule.FirstPoint)); + lesSacs.Remove(first); result.Results.Add(new Result(second.Name,tournament.Game.Id,currentRule.SecondPoint)); + lesSacs.Remove(second); thirdFourth.ForEach(r=> result.Results.Add(new Result(r.Name, tournament.Game.Id, currentRule.ThirdFourthPoint))); + thirdFourth.ForEach(p=>lesSacs.Remove(p)); Top8.ForEach(r=> result.Results.Add(new Result(r.Name, tournament.Game.Id, currentRule.Top8Point))); + Top8.ForEach(p => lesSacs.Remove(p)); Top16.ForEach(r=> result.Results.Add(new Result(r.Name, tournament.Game.Id, currentRule.Top16Point))); + Top16.ForEach(p => lesSacs.Remove(p)); + lesSacs.ForEach(r => result.Results.Add(new Result(r.Name, tournament.Game.Id, currentRule.Participation))); + // + + } result.Games = tournaments.Select(e => e.Game).ToList();