Fix: Compute HTML result with Rank instead of Point
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ namespace LaDOSE.DesktopApp.ViewModels
|
||||
$"<strong>{game.LongName} ({Results.Results.Count(e => e.GameId == game.Id)} participants) :</strong>" +
|
||||
"</span>");
|
||||
List<ResultDTO> enumerable = Results.Results.Where(r => r.GameId == game.Id).ToList();
|
||||
List<string> top3 = enumerable.OrderByDescending(e => e.Point).Take(3).Select(e => e.Player).ToList();
|
||||
List<string> top3 = enumerable.OrderBy(e => e.Rank).Take(3).Select(e => e.Player).ToList();
|
||||
sb.AppendLine($"<br> 1/ {top3[0]}<br> 2/ {top3[1]}<br> 3/ {top3[2]}<p></p>");
|
||||
sb.AppendLine($"<a href=\"https://challonge.com/fr/{enumerable.First().TournamentUrl}\" target=\"_blank\">https://challonge.com/fr/{enumerable.First().TournamentUrl}</a></p></td>");
|
||||
if (columns % 2 == 0)
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user