Smash test

test debug

Result

Disctinct by selector
Refactoring Smash/Challonge

Test Resultat

Html for Kiouze
This commit is contained in:
2022-03-11 01:14:56 +01:00
parent 45768fff80
commit aebc60d17f
16 changed files with 459 additions and 22 deletions

View File

@@ -44,6 +44,17 @@ namespace LaDOSE.DesktopApp.ViewModels
}
}
private string _slug;
public String Slug
{
get { return _slug; }
set
{
_slug = value;
NotifyOfPropertyChange(() => Slug);
}
}
private String _html;
public String Html
@@ -213,7 +224,17 @@ namespace LaDOSE.DesktopApp.ViewModels
ComputeHtml();
});
}
public void GetSmash()
{
WpfUtil.Await(() =>
{
var resultsDto = this.RestService.GetSmashResults(Slug);
this.Results = resultsDto;
ComputeDataGrid();
ComputeHtml();
});
}
public void SelectYear()
{
@@ -318,7 +339,7 @@ namespace LaDOSE.DesktopApp.ViewModels
{
StringBuilder sb = new StringBuilder();
sb.Append("<table style=\"text-align: center; margin-top: 15px;\" align=\"center\"><tbody>");
sb.Append("<table class=\"table table-responsive-md table-dark table-striped mt-lg-4 mt-3\">");
int columns = 0;
foreach (var game in Results.Games)
@@ -329,14 +350,19 @@ namespace LaDOSE.DesktopApp.ViewModels
sb.Append("<tr>");
}
columns++;
sb.Append("<td colspan=\"1\" width=\"50 % \">" +
sb.Append("<td colspan=\"1\" width=\"50%\">" +
"<span style=\"color: #ff0000;\">" +
$"<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.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 (top3.Count >= 3)
{
sb.AppendLine($"<br> 1/ {top3[0]}<br> 2/ {top3[1]}<br> 3/ {top3[2]} <br>");
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)
{
sb.Append("</tr>");

View File

@@ -18,6 +18,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="2*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -84,6 +85,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -171,7 +173,12 @@
</TabControl>
<Button Grid.Row="4" Grid.ColumnSpan="3" x:Name="Export">Export</Button>
</Grid>
<StackPanel Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal">
<TextBlock> Slug :</TextBlock>
<TextBox Width="200" Text="{Binding Slug}"></TextBox>
<Button x:Name="GetSmash" >Get Smash Tournaments Result</Button>
</StackPanel>
</Grid>
</UserControl>