Rework the UI
Fix Score Add Kiouze CSS Rework the tournaments API
This commit is contained in:
@@ -11,7 +11,8 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
|
|
||||||
namespace LaDOSE.Api.Controllers
|
namespace LaDOSE.Api.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[AllowAnonymous]
|
||||||
|
//[Authorize]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class EventController : GenericController<IEventService, Event>
|
public class EventController : GenericController<IEventService, Event>
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
|
||||||
using LaDOSE.Business.Interface;
|
|
||||||
using LaDOSE.DTO;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace LaDOSE.Api.Controllers
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
[AllowAnonymous]
|
|
||||||
#endif
|
|
||||||
[Produces("application/json")]
|
|
||||||
[Route("api/[controller]")]
|
|
||||||
public class SmashController : Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
private IExternalProviderService _service;
|
|
||||||
|
|
||||||
private IMapper _mapper;
|
|
||||||
|
|
||||||
// GET
|
|
||||||
public SmashController(IMapper mapper, IExternalProviderService service)
|
|
||||||
{
|
|
||||||
_mapper = mapper;
|
|
||||||
_service = service;
|
|
||||||
}
|
|
||||||
//This may be a get , but i dont know what the RFC State for Get request with Body
|
|
||||||
//As i don't like to populate GET request with body this will be a post (and i think
|
|
||||||
//it will be easier to proxy.
|
|
||||||
[HttpGet("GetTournament/{tournamentSlug}")]
|
|
||||||
public async Task<IActionResult> GetSmashTournament(string tournamentSlug)
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(tournamentSlug))
|
|
||||||
{
|
|
||||||
|
|
||||||
var tournaments = await _service.GetSmashResult(tournamentSlug);
|
|
||||||
|
|
||||||
return Ok(tournaments);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
[HttpGet("AddTournament/{tournamentSlug}")]
|
|
||||||
public async Task<IActionResult> AddSmashTournament(string tournamentSlug)
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(tournamentSlug))
|
|
||||||
{
|
|
||||||
//var tournaments = await _service.GetSmashResult2(tournamentSlug);
|
|
||||||
return Ok();
|
|
||||||
//return Ok(tournaments);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +1,50 @@
|
|||||||
using System;
|
//using System;
|
||||||
using System.Collections.Generic;
|
//using System.Collections.Generic;
|
||||||
using System.Linq;
|
//using System.Linq;
|
||||||
using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
using AutoMapper;
|
//using AutoMapper;
|
||||||
using LaDOSE.Business.Interface;
|
//using LaDOSE.Business.Interface;
|
||||||
using LaDOSE.DTO;
|
//using LaDOSE.DTO;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
//using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
//using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LaDOSE.Api.Controllers
|
//namespace LaDOSE.Api.Controllers
|
||||||
{
|
//{
|
||||||
#if DEBUG
|
//#if DEBUG
|
||||||
[AllowAnonymous]
|
// [AllowAnonymous]
|
||||||
#endif
|
//#endif
|
||||||
[Produces("application/json")]
|
// [Produces("application/json")]
|
||||||
[Route("api/[controller]")]
|
// [Route("api/[controller]")]
|
||||||
public class TestController : Controller
|
// public class TestController : Controller
|
||||||
{
|
// {
|
||||||
|
|
||||||
private IExternalProviderService _service;
|
// private IExternalProviderService _service;
|
||||||
|
|
||||||
private IMapper _mapper;
|
// private IMapper _mapper;
|
||||||
|
|
||||||
// GET
|
// // GET
|
||||||
public TestController(IMapper mapper, IExternalProviderService service)
|
// public TestController(IMapper mapper, IExternalProviderService service)
|
||||||
{
|
// {
|
||||||
_mapper = mapper;
|
// _mapper = mapper;
|
||||||
_service = service;
|
// _service = service;
|
||||||
}
|
// }
|
||||||
//This may be a get , but i dont know what the RFC State for Get request with Body
|
// //This may be a get , but i dont know what the RFC State for Get request with Body
|
||||||
//As i don't like to populate GET request with body this will be a post (and i think
|
// //As i don't like to populate GET request with body this will be a post (and i think
|
||||||
//it will be easier to proxy.
|
// //it will be easier to proxy.
|
||||||
[HttpGet("Test/{tournamentSlug}")]
|
// [HttpGet("Test/{tournamentSlug}")]
|
||||||
public async Task<IActionResult> GetSmashTournament(string tournamentSlug)
|
// public async Task<IActionResult> GetSmashTournament(string tournamentSlug)
|
||||||
{
|
// {
|
||||||
if (!String.IsNullOrEmpty(tournamentSlug))
|
// if (!String.IsNullOrEmpty(tournamentSlug))
|
||||||
{
|
// {
|
||||||
var tournaments = await _service.GetSmashResult(tournamentSlug);
|
// var tournaments = await _service.GetSmashResult(tournamentSlug);
|
||||||
|
|
||||||
return Ok(tournaments);
|
// return Ok(tournaments);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -25,9 +25,11 @@ namespace LaDOSE.Api.Controllers
|
|||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_service = service;
|
_service = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
//This may be a get , but i dont know what the RFC State for Get request with Body
|
//This may be a get , but i dont know what the RFC State for Get request with Body
|
||||||
//As i don't like to populate GET request with body this will be a post (and i think
|
//As i don't like to populate GET request with body this will be a post (and i think
|
||||||
//it will be easier to proxy.
|
//it will be easier to proxy.
|
||||||
|
|
||||||
[HttpPost("GetTournaments")]
|
[HttpPost("GetTournaments")]
|
||||||
public async Task<List<TournamentDTO>> GetChallonges([FromBody] TimeRangeDTO dto)
|
public async Task<List<TournamentDTO>> GetChallonges([FromBody] TimeRangeDTO dto)
|
||||||
{
|
{
|
||||||
@@ -48,12 +50,34 @@ namespace LaDOSE.Api.Controllers
|
|||||||
throw new Exception("Invalid arguments");
|
throw new Exception("Invalid arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
var test = await _service.GetChallongeEvents(ids);
|
var test = await _service.GetEventsResult(ids);
|
||||||
|
return _mapper.Map<TournamentsResultDTO>(test);
|
||||||
|
|
||||||
//var tournamentsResult = await _service.GetTournamentsResult(ids);
|
}
|
||||||
|
|
||||||
return _mapper.Map<TournamentsResultDTO>(new TournamentsResultDTO());
|
|
||||||
|
|
||||||
|
[HttpGet("ParseSmash/{tournamentSlug}")]
|
||||||
|
public async Task<bool> AddSmashTournament(string tournamentSlug)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(tournamentSlug))
|
||||||
|
{
|
||||||
|
var smash = await _service.ParseSmash(tournamentSlug);
|
||||||
|
//var tournaments = await _service.GetSmashResult2(tournamentSlug);
|
||||||
|
return smash != null;
|
||||||
|
//return Ok(tournaments);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
[HttpPost("ParseChallonge")]
|
||||||
|
public async Task<bool> ParseChallonge([FromBody] List<int> ids)
|
||||||
|
{
|
||||||
|
if (ids != null)
|
||||||
|
{
|
||||||
|
var tournaments = await _service.ParseChallonge(ids);
|
||||||
|
return tournaments.Count>0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ namespace LaDOSE.Api
|
|||||||
cfg.CreateMap<WPUser, LaDOSE.DTO.WPUserDTO>();
|
cfg.CreateMap<WPUser, LaDOSE.DTO.WPUserDTO>();
|
||||||
cfg.CreateMap<WPEvent, LaDOSE.DTO.WPEventDTO>();
|
cfg.CreateMap<WPEvent, LaDOSE.DTO.WPEventDTO>();
|
||||||
cfg.CreateMap<Result, LaDOSE.DTO.ResultDTO>();
|
cfg.CreateMap<Result, LaDOSE.DTO.ResultDTO>();
|
||||||
|
cfg.CreateMap<Event, LaDOSE.DTO.EventDTO>();
|
||||||
|
|
||||||
cfg.CreateMap<TournamentsResult, LaDOSE.DTO.TournamentsResultDTO>();
|
cfg.CreateMap<TournamentsResult, LaDOSE.DTO.TournamentsResultDTO>();
|
||||||
cfg.CreateMap<ChallongeParticipent, LaDOSE.DTO.ParticipentDTO>();
|
cfg.CreateMap<ChallongeParticipent, LaDOSE.DTO.ParticipentDTO>();
|
||||||
cfg.CreateMap<ChallongeTournament, LaDOSE.DTO.TournamentDTO>();
|
cfg.CreateMap<ChallongeTournament, LaDOSE.DTO.TournamentDTO>();
|
||||||
|
|||||||
8
LaDOSE.Src/LaDOSE.DTO/EventDTO.cs
Normal file
8
LaDOSE.Src/LaDOSE.DTO/EventDTO.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace LaDOSE.DTO
|
||||||
|
{
|
||||||
|
public class EventDTO
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -240,6 +240,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Services\" />
|
<Folder Include="Services\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Resources\css.css" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
343
LaDOSE.Src/LaDOSE.DesktopApp/Resources/css.css
Normal file
343
LaDOSE.Src/LaDOSE.DesktopApp/Resources/css.css
Normal file
@@ -0,0 +1,343 @@
|
|||||||
|
body {
|
||||||
|
color: #efefef;
|
||||||
|
background-color: #141415;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--breakpoint-xs: 0;
|
||||||
|
--breakpoint-sm: 576px;
|
||||||
|
--breakpoint-md: 768px;
|
||||||
|
--breakpoint-lg: 992px;
|
||||||
|
--breakpoint-xl: 1200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
padding: 0.75rem;
|
||||||
|
vertical-align: top;
|
||||||
|
border-top: 1px solid #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table thead th {
|
||||||
|
vertical-align: bottom;
|
||||||
|
border-bottom: 2px solid #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody + tbody {
|
||||||
|
border-top: 2px solid #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table .table {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-sm th,
|
||||||
|
.table-sm td {
|
||||||
|
padding: 0.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-bordered {
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-bordered th,
|
||||||
|
.table-bordered td {
|
||||||
|
border: 1px solid #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-bordered thead th,
|
||||||
|
.table-bordered thead td {
|
||||||
|
border-bottom-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-borderless th,
|
||||||
|
.table-borderless td,
|
||||||
|
.table-borderless thead th,
|
||||||
|
.table-borderless tbody + tbody {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-striped tbody tr:nth-of-type(odd) {
|
||||||
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover tbody tr:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.075);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-primary,
|
||||||
|
.table-primary > th,
|
||||||
|
.table-primary > td {
|
||||||
|
background-color: #b8daff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-primary:hover {
|
||||||
|
background-color: #9fcdff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-primary:hover > td,
|
||||||
|
.table-hover .table-primary:hover > th {
|
||||||
|
background-color: #9fcdff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-secondary,
|
||||||
|
.table-secondary > th,
|
||||||
|
.table-secondary > td {
|
||||||
|
background-color: #d6d8db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-secondary:hover {
|
||||||
|
background-color: #c8cbcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-secondary:hover > td,
|
||||||
|
.table-hover .table-secondary:hover > th {
|
||||||
|
background-color: #c8cbcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-success,
|
||||||
|
.table-success > th,
|
||||||
|
.table-success > td {
|
||||||
|
background-color: #c3e6cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-success:hover {
|
||||||
|
background-color: #b1dfbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-success:hover > td,
|
||||||
|
.table-hover .table-success:hover > th {
|
||||||
|
background-color: #b1dfbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-info,
|
||||||
|
.table-info > th,
|
||||||
|
.table-info > td {
|
||||||
|
background-color: #bee5eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-info:hover {
|
||||||
|
background-color: #abdde5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-info:hover > td,
|
||||||
|
.table-hover .table-info:hover > th {
|
||||||
|
background-color: #abdde5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-warning,
|
||||||
|
.table-warning > th,
|
||||||
|
.table-warning > td {
|
||||||
|
background-color: #ffeeba;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-warning:hover {
|
||||||
|
background-color: #ffe8a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-warning:hover > td,
|
||||||
|
.table-hover .table-warning:hover > th {
|
||||||
|
background-color: #ffe8a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-danger,
|
||||||
|
.table-danger > th,
|
||||||
|
.table-danger > td {
|
||||||
|
background-color: #f5c6cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-danger:hover {
|
||||||
|
background-color: #f1b0b7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-danger:hover > td,
|
||||||
|
.table-hover .table-danger:hover > th {
|
||||||
|
background-color: #f1b0b7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-light,
|
||||||
|
.table-light > th,
|
||||||
|
.table-light > td {
|
||||||
|
background-color: #fdfdfe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-light:hover {
|
||||||
|
background-color: #ececf6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-light:hover > td,
|
||||||
|
.table-hover .table-light:hover > th {
|
||||||
|
background-color: #ececf6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark,
|
||||||
|
.table-dark > th,
|
||||||
|
.table-dark > td {
|
||||||
|
background-color: #c6c8ca;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-dark:hover {
|
||||||
|
background-color: #b9bbbe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-dark:hover > td,
|
||||||
|
.table-hover .table-dark:hover > th {
|
||||||
|
background-color: #b9bbbe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-active,
|
||||||
|
.table-active > th,
|
||||||
|
.table-active > td {
|
||||||
|
background-color: rgba(0, 0, 0, 0.075);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-active:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.075);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-hover .table-active:hover > td,
|
||||||
|
.table-hover .table-active:hover > th {
|
||||||
|
background-color: rgba(0, 0, 0, 0.075);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table .thead-dark th {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #212529;
|
||||||
|
border-color: #32383e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table .thead-light th {
|
||||||
|
color: #495057;
|
||||||
|
background-color: #e9ecef;
|
||||||
|
border-color: #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark th,
|
||||||
|
.table-dark td,
|
||||||
|
.table-dark thead th {
|
||||||
|
border-color: #32383e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark.table-bordered {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark.table-striped tbody tr:nth-of-type(odd) {
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark.table-hover tbody tr:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.075);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 575.98px) {
|
||||||
|
.table-responsive-sm {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive-sm > .table-bordered {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767.98px) {
|
||||||
|
.table-responsive-md {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive-md > .table-bordered {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 991.98px) {
|
||||||
|
.table-responsive-lg {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive-lg > .table-bordered {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1199.98px) {
|
||||||
|
.table-responsive-xl {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive-xl > .table-bordered {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
-ms-overflow-style: -ms-autohiding-scrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-responsive > .table-bordered {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border-collapse: collapse !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td,
|
||||||
|
.table th {
|
||||||
|
/*background-color: #fff !important;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-bordered th,
|
||||||
|
.table-bordered td {
|
||||||
|
border: 1px solid #dee2e6 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #212529
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-dark th,
|
||||||
|
.table-dark td,
|
||||||
|
.table-dark thead th,
|
||||||
|
.table-dark tbody + tbody {
|
||||||
|
border-color: #dee2e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table .thead-dark th {
|
||||||
|
color: inherit;
|
||||||
|
border-color: #dee2e6;
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@@ -26,12 +27,14 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
private string css = "strong { font-weight: 700;} " +
|
private string css = string.Empty;
|
||||||
"a { color: #ff9024;}"+
|
|
||||||
"body { color: #efefef;background-color: #141415; }" +
|
//"strong { font-weight: 700;} ". +
|
||||||
""+
|
// "a { color: #ff9024;}"+
|
||||||
"a:hover, .entry-meta span a:hover, .comments-link a:hover, body.coldisplay2 #front-columns a:active {color: #cb5920;}"+
|
// "body { color: #efefef;background-color: #141415; }" +
|
||||||
"tr td { border: 1px dashed #3D3D3D;} ";
|
// ""+
|
||||||
|
// "a:hover, .entry-meta span a:hover, .comments-link a:hover, body.coldisplay2 #front-columns a:active {color: #cb5920;}"+
|
||||||
|
// "tr td { border: 1px dashed #3D3D3D;} ";
|
||||||
private String _selectRegex;
|
private String _selectRegex;
|
||||||
|
|
||||||
public String SelectRegex
|
public String SelectRegex
|
||||||
@@ -44,6 +47,17 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String _selectEventRegex;
|
||||||
|
|
||||||
|
public String SelectEventRegex
|
||||||
|
{
|
||||||
|
get { return _selectEventRegex; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectEventRegex = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectEventRegex);
|
||||||
|
}
|
||||||
|
}
|
||||||
private string _slug;
|
private string _slug;
|
||||||
public String Slug
|
public String Slug
|
||||||
{
|
{
|
||||||
@@ -108,6 +122,8 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
private TournamentsResultDTO _results;
|
private TournamentsResultDTO _results;
|
||||||
public List<TournamentDTO> Tournaments { get; set; }
|
public List<TournamentDTO> Tournaments { get; set; }
|
||||||
|
|
||||||
|
public List<EventDTO> Events { get; set; }
|
||||||
|
|
||||||
public TournamentsResultDTO Results
|
public TournamentsResultDTO Results
|
||||||
{
|
{
|
||||||
get => _results;
|
get => _results;
|
||||||
@@ -118,6 +134,18 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<EventDTO> _selectedEvents;
|
||||||
|
|
||||||
|
public ObservableCollection<EventDTO> SelectedEvents
|
||||||
|
{
|
||||||
|
get { return _selectedEvents; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedEvents = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedEvents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ObservableCollection<TournamentDTO> _selectedTournaments;
|
private ObservableCollection<TournamentDTO> _selectedTournaments;
|
||||||
|
|
||||||
public ObservableCollection<TournamentDTO> SelectedTournaments
|
public ObservableCollection<TournamentDTO> SelectedTournaments
|
||||||
@@ -178,18 +206,28 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
{
|
{
|
||||||
this.RestService = restService;
|
this.RestService = restService;
|
||||||
_selectedTournaments = new ObservableCollection<TournamentDTO>();
|
_selectedTournaments = new ObservableCollection<TournamentDTO>();
|
||||||
|
_selectedEvents = new ObservableCollection<EventDTO>();
|
||||||
Tournaments = new List<TournamentDTO>();
|
Tournaments = new List<TournamentDTO>();
|
||||||
|
Events = new List<EventDTO>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override void OnInitialize()
|
protected override void OnInitialize()
|
||||||
{
|
{
|
||||||
|
var manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LaDOSE.DesktopApp.Resources.css.css");
|
||||||
|
using (var sr = new StreamReader(manifestResourceStream))
|
||||||
|
{
|
||||||
|
this.css = sr.ReadToEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.To = DateTime.Now;
|
this.To = DateTime.Now;
|
||||||
this.From = DateTime.Now.AddMonths(-1);
|
this.From = DateTime.Now.AddMonths(-1);
|
||||||
this.SelectRegex = "Ranking";
|
this.SelectRegex = "Ranking";
|
||||||
this.Slug = "ranking-1001";
|
this.Slug = "ranking-1001";
|
||||||
LoadTournaments();
|
LoadTournaments();
|
||||||
|
LoadEvents();
|
||||||
base.OnInitialize();
|
base.OnInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +243,18 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadEvents()
|
||||||
|
{
|
||||||
|
WpfUtil.Await(() =>
|
||||||
|
{
|
||||||
|
var eventsDtos = this.RestService
|
||||||
|
.GetAllEvents().ToList();
|
||||||
|
this.Events = eventsDtos;
|
||||||
|
|
||||||
|
NotifyOfPropertyChange("Events");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public DataTable GridDataTable
|
public DataTable GridDataTable
|
||||||
{
|
{
|
||||||
get => _gridDataTable;
|
get => _gridDataTable;
|
||||||
@@ -219,7 +269,7 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
{
|
{
|
||||||
WpfUtil.Await(() =>
|
WpfUtil.Await(() =>
|
||||||
{
|
{
|
||||||
var tournamentsIds = SelectedTournaments.Select(e => e.ChallongeId).ToList();
|
var tournamentsIds = SelectedEvents.Select(e => e.Id).ToList();
|
||||||
var resultsDto = this.RestService.GetResults(tournamentsIds);
|
var resultsDto = this.RestService.GetResults(tournamentsIds);
|
||||||
this.Results = resultsDto;
|
this.Results = resultsDto;
|
||||||
ComputeDataGrid();
|
ComputeDataGrid();
|
||||||
@@ -231,12 +281,30 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
WpfUtil.Await(() =>
|
WpfUtil.Await(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
var resultsDto = this.RestService.GetSmashResults(Slug);
|
var resultsDto = this.RestService.ParseSmash(Slug);
|
||||||
this.Results = resultsDto;
|
if (!resultsDto)
|
||||||
ComputeDataGrid();
|
{
|
||||||
ComputeHtml();
|
MessageBox.Show("Fail");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public void GetChallonge()
|
||||||
|
{
|
||||||
|
WpfUtil.Await(() =>
|
||||||
|
{
|
||||||
|
var ids = SelectedTournaments.Select(e => e.ChallongeId).ToList();
|
||||||
|
var resultsDto = this.RestService.ParseChallonge(ids);
|
||||||
|
if (!resultsDto)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Fail");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateEvent()
|
||||||
|
{
|
||||||
|
LoadEvents();
|
||||||
|
}
|
||||||
|
|
||||||
public void SelectYear()
|
public void SelectYear()
|
||||||
{
|
{
|
||||||
@@ -257,6 +325,13 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
if (selectedTournaments.Count > 0)
|
if (selectedTournaments.Count > 0)
|
||||||
selectedTournaments.ForEach(e => this.SelectedTournaments.AddUI(e));
|
selectedTournaments.ForEach(e => this.SelectedTournaments.AddUI(e));
|
||||||
}
|
}
|
||||||
|
public void SelectEvent()
|
||||||
|
{
|
||||||
|
var selectedEvents = this.Events.Where(e => Regex.IsMatch(e.Name, this.SelectEventRegex)).ToList();
|
||||||
|
this.SelectedEvents.Clear();
|
||||||
|
if (selectedEvents.Count > 0)
|
||||||
|
selectedEvents.ForEach(e => this.SelectedEvents.AddUI(e));
|
||||||
|
}
|
||||||
//This could be simplified the Dictionary was for a previous usage, but i m too lazy to rewrite it.
|
//This could be simplified the Dictionary was for a previous usage, but i m too lazy to rewrite it.
|
||||||
private void ComputeDataGrid()
|
private void ComputeDataGrid()
|
||||||
{
|
{
|
||||||
@@ -344,7 +419,11 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
sb.Append("<table class=\"table table-responsive-md table-dark table-striped mt-lg-4 mt-3\">");
|
sb.Append("<table class=\"table table-responsive-md table-dark table-striped mt-lg-4 mt-3\">");
|
||||||
|
|
||||||
int columns = 0;
|
int columns = 0;
|
||||||
foreach (var game in Results.Games)
|
|
||||||
|
var distinct = Results.Results.Select(e => e.GameId).Distinct();
|
||||||
|
|
||||||
|
var gamePlayed = Results.Games.Where(e=> distinct.Contains(e.Id));
|
||||||
|
foreach (var game in gamePlayed)
|
||||||
{
|
{
|
||||||
List<ResultDTO> enumerable = Results.Results.Where(r => r.GameId == game.Id).ToList();
|
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();
|
List<string> top3 = enumerable.OrderBy(e => e.Rank).Take(3).Select(e => e.Player).ToList();
|
||||||
@@ -358,7 +437,15 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
sb.Append("<tr>");
|
sb.Append("<tr>");
|
||||||
}
|
}
|
||||||
columns++;
|
columns++;
|
||||||
sb.Append("<td colspan=\"1\" width=\"50%\">" +
|
var span = 1;
|
||||||
|
if (columns == gamePlayed.Count())
|
||||||
|
{
|
||||||
|
if (columns % 2 != 0)
|
||||||
|
{
|
||||||
|
span = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.Append($"<td colspan=\"{span}\" width=\"50%\">" +
|
||||||
"<span style=\"color: #ff0000;\">" +
|
"<span style=\"color: #ff0000;\">" +
|
||||||
$"<strong>{game.LongName} ({Results.Results.Count(e => e.GameId == game.Id)} participants) :</strong>" +
|
$"<strong>{game.LongName} ({Results.Results.Count(e => e.GameId == game.Id)} participants) :</strong>" +
|
||||||
"</span>");
|
"</span>");
|
||||||
@@ -366,7 +453,11 @@ namespace LaDOSE.DesktopApp.ViewModels
|
|||||||
if (top3.Count >= 3)
|
if (top3.Count >= 3)
|
||||||
{
|
{
|
||||||
sb.AppendLine($"<br> 1/ {top3[0]}<br> 2/ {top3[1]}<br> 3/ {top3[2]} <br>");
|
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>");
|
//<a href=\"https://challonge.com/fr/{enumerable.First().TournamentUrl}\" target=\"_blank\">https://challonge.com/fr/{enumerable.First().TournamentUrl}</a>
|
||||||
|
var url = enumerable.FirstOrDefault().TournamentUrl;
|
||||||
|
url = url.Replace(" ", "-");
|
||||||
|
url = url.Replace(".", "-");
|
||||||
|
sb.AppendLine($"<a href=\"https://smash.gg/tournament/ranking-1002/event/{url}\" target=\"_blank\">Voir le Bracket</p></td>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,17 +14,35 @@
|
|||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid Row="2" Column="1">
|
<Grid Row="2" Column="1">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="2*" />
|
<RowDefinition Height="2*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
|
<Grid Row="0" Column="0">
|
||||||
<Label> Date : </Label>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Row="0" Column="0">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,5">
|
||||||
|
<Label>Date :</Label>
|
||||||
<StackPanel Orientation="Horizontal" Width="210">
|
<StackPanel Orientation="Horizontal" Width="210">
|
||||||
<DatePicker SelectedDate="{Binding From}" Width="100" BorderBrush="{x:Null}">
|
<DatePicker SelectedDate="{Binding From}" Width="100" BorderBrush="{x:Null}">
|
||||||
<DatePicker.Resources>
|
<DatePicker.Resources>
|
||||||
@@ -79,6 +97,53 @@
|
|||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
|
|
||||||
</ListView>
|
</ListView>
|
||||||
|
<DockPanel Grid.Row="3" Dock="Left">
|
||||||
|
<Label>Select :</Label>
|
||||||
|
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
|
||||||
|
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp">Select</Button>
|
||||||
|
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="GetChallonge">Import</Button>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<Grid Row="0" Column="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Margin="0,0,0,6">
|
||||||
|
<Label> Smash Slug :</Label>
|
||||||
|
<TextBox Width="200" Text="{Binding Slug}"></TextBox>
|
||||||
|
<Button Margin="5,0,5,0" x:Name="GetSmash" >Import Smash Event</Button>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button Grid.Row="1" x:Name="UpdateEvent" >Update Event</Button>
|
||||||
|
|
||||||
|
<ListView Grid.Row="2" ItemsSource="{Binding Events}" Margin="0,0,0,5"
|
||||||
|
IsTextSearchEnabled="True" TextSearch.TextPath="Name"
|
||||||
|
behaviors:MultiSelectorBehaviours.SynchronizedSelectedItems="{Binding SelectedEvents}">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding Id}" />
|
||||||
|
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
|
||||||
|
</ListView>
|
||||||
|
<DockPanel Grid.Row="3" Dock="Left">
|
||||||
|
<Label>Select :</Label>
|
||||||
|
<TextBox Width="200" Text="{Binding SelectEventRegex}"></TextBox>
|
||||||
|
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectEvent">Select</Button>
|
||||||
|
</DockPanel>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid Row="3">
|
<Grid Row="3">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@@ -93,13 +158,13 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="2*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<DockPanel Grid.Row="0" Grid.ColumnSpan="3" Dock="Left">
|
<!--<DockPanel Grid.Row="0" Grid.ColumnSpan="3" Dock="Left">
|
||||||
<Label>Select :</Label>
|
<Label>Select :</Label>
|
||||||
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
|
<TextBox Width="200" Text="{Binding SelectRegex}"></TextBox>
|
||||||
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp">Select</Button>
|
<Button Padding="5,0,5,0" Margin="5,0,5,0" x:Name="SelectRegexp">Select</Button>
|
||||||
<Button x:Name="Select" >Get Tournaments Result</Button>
|
<Button x:Name="Select" >Get Tournaments Result</Button>
|
||||||
</DockPanel>
|
</DockPanel>-->
|
||||||
|
<Button x:Name="Select" Grid.ColumnSpan="3" >Get Tournaments Result</Button>
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal">
|
<StackPanel Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal">
|
||||||
@@ -166,7 +231,7 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="HTML">
|
<TabItem Header="HTML">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Button x:Name="CopyHtml" DockPanel.Dock="Top"> Copy HTML to clipboard </Button>
|
<Button x:Name="CopyHtml" DockPanel.Dock="Top">Copy HTML to clipboard</Button>
|
||||||
<cefSharp:ChromiumWebBrowser behaviors:HtmlBehavior.Html="{Binding Html}" />
|
<cefSharp:ChromiumWebBrowser behaviors:HtmlBehavior.Html="{Binding Html}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -175,10 +240,6 @@
|
|||||||
<Button Grid.Row="4" Grid.ColumnSpan="3" x:Name="Export">Export</Button>
|
<Button Grid.Row="4" Grid.ColumnSpan="3" x:Name="Export">Export</Button>
|
||||||
|
|
||||||
</Grid>
|
</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>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -281,15 +281,29 @@ namespace LaDOSE.REST
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TournamentsResultDTO GetSmashResults(string slug)
|
|
||||||
|
public bool ParseSmash(string slug)
|
||||||
{
|
{
|
||||||
CheckToken();
|
CheckToken();
|
||||||
var restRequest = new RestRequest($"Api/Smash/GetTournament/{slug}", Method.GET);
|
var restRequest = new RestRequest($"Api/Tournament/ParseSmash/{slug}", Method.GET);
|
||||||
var restResponse = Client.Get<TournamentsResultDTO>(restRequest);
|
var restResponse = Client.Get<bool>(restRequest);
|
||||||
return restResponse.Data;
|
return restResponse.Data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ParseChallonge(List<int> ids)
|
||||||
|
{
|
||||||
|
CheckToken();
|
||||||
|
return Post<List<int>, bool>("Api/Tournament/ParseChallonge", ids);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public List<EventDTO> GetAllEvents()
|
||||||
|
{
|
||||||
|
CheckToken();
|
||||||
|
var restRequest = new RestRequest("/api/Event", Method.GET);
|
||||||
|
var restResponse = Client.Get<List<EventDTO>>(restRequest);
|
||||||
|
return restResponse.Data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,9 @@ namespace LaDOSE.Business.Interface
|
|||||||
Task<ChallongeTournament> GetTournament(int idTournament);
|
Task<ChallongeTournament> GetTournament(int idTournament);
|
||||||
Task<ChallongeTournament> GetTournament(string urlTournament);
|
Task<ChallongeTournament> GetTournament(string urlTournament);
|
||||||
|
|
||||||
Task<List<Event>> GetEvents(List<int> idTournaments);
|
Task<List<Event>> ParseEvent(List<int> idTournaments);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,14 @@ namespace LaDOSE.Business.Interface
|
|||||||
public interface IExternalProviderService
|
public interface IExternalProviderService
|
||||||
{
|
{
|
||||||
Task<List<ChallongeTournament>> GetTournaments(DateTime? start, DateTime? end);
|
Task<List<ChallongeTournament>> GetTournaments(DateTime? start, DateTime? end);
|
||||||
|
Task<Event> ParseSmash(string tournamentSlug);
|
||||||
|
Task<List<Event>> ParseChallonge(List<int> ids);
|
||||||
|
|
||||||
Task<TournamentsResult> GetTournamentsResult(List<int> ids);
|
//Task<TournamentsResult> GetChallongeTournamentsResult(List<int> ids);
|
||||||
Task<TournamentsResult> GetSmashResult(string tournamentSlug);
|
//Task<TournamentsResult> GetSmashResult(string tournamentSlug);
|
||||||
|
|
||||||
Task<List<Event>> GetChallongeEvents(List<int> ids);
|
Task<List<Event>> GetChallongeEvents(List<int> ids);
|
||||||
|
|
||||||
|
Task<TournamentsResult> GetEventsResult(List<int> ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ namespace LaDOSE.Business.Provider.ChallongProvider
|
|||||||
private const string RegexRanking = @"[R|r]anking.?#\w{3}";
|
private const string RegexRanking = @"[R|r]anking.?#\w{3}";
|
||||||
private const string DateRanking = @"^\[(\d{2}\/\d{2}\/\d{2})\]";
|
private const string DateRanking = @"^\[(\d{2}\/\d{2}\/\d{2})\]";
|
||||||
private const string GameRanking = @"\-.(\w*)$";
|
private const string GameRanking = @"\-.(\w*)$";
|
||||||
public async Task<List<Event>> GetEvents(List<int> idTournaments)
|
public async Task<List<Event>> ParseEvent(List<int> idTournaments)
|
||||||
{
|
{
|
||||||
var result = new List<Event>();
|
var result = new List<Event>();
|
||||||
foreach (var idTournament in idTournaments)
|
foreach (var idTournament in idTournaments)
|
||||||
|
|||||||
@@ -128,6 +128,10 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
entrant {
|
||||||
|
id,
|
||||||
|
isDisqualified
|
||||||
}
|
}
|
||||||
placement
|
placement
|
||||||
}
|
}
|
||||||
@@ -161,7 +165,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var res= standings.Select(x => new Result()
|
var res= standings.Where(s=>s.entrant.isDisqualified != true).Select(x => new Result()
|
||||||
{
|
{
|
||||||
Tournament = tournament,
|
Tournament = tournament,
|
||||||
TournamentId = tournament.Id,
|
TournamentId = tournament.Id,
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
|
|
||||||
public StatType stats { get; set; }
|
public StatType stats { get; set; }
|
||||||
|
|
||||||
|
public EntrantType entrant { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ParticipantType
|
public class ParticipantType
|
||||||
@@ -67,6 +69,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EventType
|
public class EventType
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
@@ -83,7 +86,7 @@ namespace LaDOSE.Business.Provider.SmashProvider
|
|||||||
{
|
{
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
|
public bool? isDisqualified { get; set; }
|
||||||
public List<ParticipantType> participants { get; set; }
|
public List<ParticipantType> participants { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Reactive.Subjects;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using LaDOSE.Business.Helper;
|
using LaDOSE.Business.Helper;
|
||||||
using LaDOSE.Business.Interface;
|
using LaDOSE.Business.Interface;
|
||||||
@@ -75,88 +77,88 @@ namespace LaDOSE.Business.Service
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TournamentsResult> GetTournamentsResult(List<int> ids)
|
//public async Task<TournamentsResult> GetChallongeTournamentsResult(List<int> ids)
|
||||||
{
|
|
||||||
TournamentsResult result = new TournamentsResult();
|
|
||||||
result.Results = new List<Result>();
|
|
||||||
var players = _context.WPUser.ToList();
|
|
||||||
var games = _context.Game.ToList();
|
|
||||||
var tournaments = await GetChallongeTournaments(ids, games);
|
|
||||||
|
|
||||||
var allParticipent = tournaments.SelectMany(e => e.Participents).Distinct((a, b) => a.Name == b.Name)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
|
|
||||||
allParticipent.RemoveAll(e => e.Name.StartsWith("[FORFAIT]"));
|
|
||||||
//USELESS
|
|
||||||
//foreach (var participent in allParticipent)
|
|
||||||
//{
|
//{
|
||||||
// var player = players.FirstOrDefault(e => e.Name.Contains(participent.Name));
|
// TournamentsResult result = new TournamentsResult();
|
||||||
// if (player != null)
|
// result.Results = new List<Result>();
|
||||||
|
// var players = _context.WPUser.ToList();
|
||||||
|
// var games = _context.Game.ToList();
|
||||||
|
// var tournaments = await GetChallongeTournaments(ids, games);
|
||||||
|
|
||||||
|
// var allParticipent = tournaments.SelectMany(e => e.Participents).Distinct((a, b) => a.Name == b.Name)
|
||||||
|
// .ToList();
|
||||||
|
|
||||||
|
|
||||||
|
// allParticipent.RemoveAll(e => e.Name.StartsWith("[FORFAIT]"));
|
||||||
|
// //USELESS
|
||||||
|
// //foreach (var participent in allParticipent)
|
||||||
|
// //{
|
||||||
|
// // var player = players.FirstOrDefault(e => e.Name.Contains(participent.Name));
|
||||||
|
// // if (player != null)
|
||||||
|
// // {
|
||||||
|
// // participent.IsMember = true;
|
||||||
|
// // }
|
||||||
|
// //}
|
||||||
|
|
||||||
|
// result.Participents = allParticipent;
|
||||||
|
|
||||||
|
// foreach (var tournament in tournaments)
|
||||||
// {
|
// {
|
||||||
// participent.IsMember = true;
|
|
||||||
|
|
||||||
|
// var playerCount = tournament.Participents.Count;
|
||||||
|
// var lesSacs = tournament.Participents;
|
||||||
|
// var currentRule = TournamentRules.FirstOrDefault(rules =>
|
||||||
|
// rules.PlayerMin < playerCount && rules.PlayerMax >= playerCount
|
||||||
|
// );
|
||||||
|
// if (currentRule == null)
|
||||||
|
// {
|
||||||
|
// throw new Exception("Unable to find rules");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// var first = tournament.Participents.First(p => p.Rank == 1);
|
||||||
|
// var second = tournament.Participents.First(p => p.Rank == 2);
|
||||||
|
// var thirdFourth = tournament.Participents.Where(p => p.Rank == 3 || p.Rank == 4).ToList();
|
||||||
|
// 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 ?? 0, tournament.ChallongeId, tournament.Url, currentRule.FirstPoint, first.Rank ?? 0));
|
||||||
|
// lesSacs.Remove(first);
|
||||||
|
// result.Results.Add(new Result(second.Name, tournament.Game?.Id ?? 0, 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 ?? 0, tournament.ChallongeId, tournament.Url,
|
||||||
|
// 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 ?? 0, tournament.ChallongeId, tournament.Url, currentRule.Top8Point, r.Rank ?? 0)));
|
||||||
|
// Top8.ForEach(p => lesSacs.Remove(p));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (currentRule.Top16Point != 0)
|
||||||
|
// {
|
||||||
|
// Top16.ForEach(r =>
|
||||||
|
// result.Results.Add(
|
||||||
|
// new Result(r.Name, tournament.Game?.Id ?? 0, 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 ?? 0, tournament.ChallongeId, tournament.Url,
|
||||||
|
// currentRule.Participation, r.Rank ?? 0)));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// result.Games = tournaments.Select(e => e.Game).Distinct((game, game1) => game.Name == game1.Name).Where(e => e != null).ToList();
|
||||||
|
// if (result.Games == null)
|
||||||
|
// {
|
||||||
|
// result.Games = new List<Game>();
|
||||||
|
// }
|
||||||
|
// result.Games.Add(new Game() { Id = 0, Order = 9999, Name = "UNKNOW" });
|
||||||
|
// return result;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
result.Participents = allParticipent;
|
|
||||||
|
|
||||||
foreach (var tournament in tournaments)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
var playerCount = tournament.Participents.Count;
|
|
||||||
var lesSacs = tournament.Participents;
|
|
||||||
var currentRule = TournamentRules.FirstOrDefault(rules =>
|
|
||||||
rules.PlayerMin < playerCount && rules.PlayerMax >= playerCount
|
|
||||||
);
|
|
||||||
if (currentRule == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Unable to find rules");
|
|
||||||
}
|
|
||||||
|
|
||||||
var first = tournament.Participents.First(p => p.Rank == 1);
|
|
||||||
var second = tournament.Participents.First(p => p.Rank == 2);
|
|
||||||
var thirdFourth = tournament.Participents.Where(p => p.Rank == 3 || p.Rank == 4).ToList();
|
|
||||||
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 ?? 0, tournament.ChallongeId, tournament.Url, currentRule.FirstPoint, first.Rank ?? 0));
|
|
||||||
lesSacs.Remove(first);
|
|
||||||
result.Results.Add(new Result(second.Name, tournament.Game?.Id ?? 0, 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 ?? 0, tournament.ChallongeId, tournament.Url,
|
|
||||||
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 ?? 0, tournament.ChallongeId, tournament.Url, currentRule.Top8Point, r.Rank ?? 0)));
|
|
||||||
Top8.ForEach(p => lesSacs.Remove(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentRule.Top16Point != 0)
|
|
||||||
{
|
|
||||||
Top16.ForEach(r =>
|
|
||||||
result.Results.Add(
|
|
||||||
new Result(r.Name, tournament.Game?.Id ?? 0, 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 ?? 0, tournament.ChallongeId, tournament.Url,
|
|
||||||
currentRule.Participation, r.Rank ?? 0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Games = tournaments.Select(e => e.Game).Distinct((game, game1) => game.Name == game1.Name).Where(e => e != null).ToList();
|
|
||||||
if (result.Games == null)
|
|
||||||
{
|
|
||||||
result.Games = new List<Game>();
|
|
||||||
}
|
|
||||||
result.Games.Add(new Game() { Id = 0, Order = 9999, Name = "UNKNOW" });
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<Event> ParseSmash(string tournamentSlug)
|
public async Task<Event> ParseSmash(string tournamentSlug)
|
||||||
{
|
{
|
||||||
@@ -189,23 +191,33 @@ namespace LaDOSE.Business.Service
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<List<Event>> ParseChallonge(List<int> ids)
|
||||||
|
{
|
||||||
|
return _challongeProvider.ParseEvent(ids);
|
||||||
|
}
|
||||||
|
|
||||||
private Event GetBySlug(string tournamentSlug)
|
private Event GetBySlug(string tournamentSlug)
|
||||||
{
|
{
|
||||||
return _context.Event.FirstOrDefault(e => e.SmashSlug == tournamentSlug);
|
return _context.Event.FirstOrDefault(e => e.SmashSlug == tournamentSlug);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TournamentsResult> GetSmashResult(string tournamentSlug)
|
//public async Task<TournamentsResult> GetSmashResult(string tournamentSlug)
|
||||||
{
|
//{
|
||||||
var parse = await this.ParseSmash(tournamentSlug);
|
// var parse = await this.ParseSmash(tournamentSlug);
|
||||||
var test = await GetEventResult(parse.Id);
|
// var test = await GetEventResult(parse.Id);
|
||||||
return test;
|
// return test;
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
//public async Task<TournamentsResult> GetEventsResult(List<int> events)
|
||||||
|
//{
|
||||||
|
// var test = await GetEventsResult(events);
|
||||||
|
// return test;
|
||||||
|
//}
|
||||||
|
|
||||||
public async Task<List<Event>> GetChallongeEvents(List<int> ids)
|
public async Task<List<Event>> GetChallongeEvents(List<int> ids)
|
||||||
{
|
{
|
||||||
var events = await this._challongeProvider.GetEvents(ids);
|
var events = await this._challongeProvider.ParseEvent(ids);
|
||||||
this._context.Event.AddRange(events);
|
this._context.Event.AddRange(events);
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
@@ -251,6 +263,108 @@ namespace LaDOSE.Business.Service
|
|||||||
return this._context.ChallongeTournament.Any(e => e.ChallongeId == idTournament);
|
return this._context.ChallongeTournament.Any(e => e.ChallongeId == idTournament);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Events Result
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<TournamentsResult> GetEventsResult(List<int> id)
|
||||||
|
{
|
||||||
|
var cevent = new Event();
|
||||||
|
cevent.Tournaments = new List<Tournament>();
|
||||||
|
List<Player> players = new List<Player>();
|
||||||
|
foreach (var eventId in id)
|
||||||
|
{
|
||||||
|
Event e = _context.Event.Include(e => e.Tournaments).ThenInclude(t => t.Results).ThenInclude(e => e.Player).FirstOrDefault(e => e.Id == eventId);
|
||||||
|
players = players.Concat(e.Tournaments.SelectMany(e => e.Results.Select(e => e.Player)).Distinct().ToList()).ToList();
|
||||||
|
cevent.Tournaments = cevent.Tournaments.Concat(e.Tournaments).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var games = _context.Game.ToList();
|
||||||
|
|
||||||
|
TournamentsResult result = new TournamentsResult();
|
||||||
|
result.Results = new List<Result>();
|
||||||
|
result.Games = new List<Game>();
|
||||||
|
result.Participents = new List<ChallongeParticipent>();
|
||||||
|
players.ForEach(e =>
|
||||||
|
{
|
||||||
|
var x = new ChallongeParticipent()
|
||||||
|
{
|
||||||
|
Name = e.Gamertag,
|
||||||
|
ChallongeId = e.Id,
|
||||||
|
Id = e.Id
|
||||||
|
};
|
||||||
|
result.Participents.Add(x);
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var tournament in cevent.Tournaments.Where(e => e.Results != null && e.Results.Any()).ToList())
|
||||||
|
{
|
||||||
|
|
||||||
|
var tplayer = tournament.Results.Select(e => e.Player).ToList();
|
||||||
|
var playerCount = tplayer.Count();
|
||||||
|
var lesSacs = tplayer;
|
||||||
|
var currentRule = TournamentRules.FirstOrDefault(rules =>
|
||||||
|
rules.PlayerMin < playerCount && rules.PlayerMax >= playerCount
|
||||||
|
);
|
||||||
|
if (currentRule == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Unable to find rules");
|
||||||
|
}
|
||||||
|
|
||||||
|
var first = tournament.Results.First(p => p.Rank == 1);
|
||||||
|
var second = tournament.Results.First(p => p.Rank == 2);
|
||||||
|
var thirdFourth = tournament.Results.Where(p => p.Rank == 3 || p.Rank == 4).ToList();
|
||||||
|
var Top8 = tournament.Results.Where(p => p.Rank > 4 && p.Rank < 9).ToList();
|
||||||
|
var Top16 = tournament.Results.Where(p => p.Rank > 8 && p.Rank <= 16).ToList();
|
||||||
|
|
||||||
|
result.Results.Add(new Result(first.Player.Gamertag, tournament.Game?.Id ?? 0, tournament.Id, tournament.Name, currentRule.FirstPoint, first.Rank));
|
||||||
|
lesSacs.Remove(first.Player);
|
||||||
|
result.Results.Add(new Result(second.Player.Gamertag, tournament.Game?.Id ?? 0, tournament.Id, tournament.Name, currentRule.SecondPoint, second.Rank));
|
||||||
|
lesSacs.Remove(second.Player);
|
||||||
|
thirdFourth.ForEach(r =>
|
||||||
|
result.Results.Add(new Result(r.Player.Gamertag, tournament.Game?.Id ?? 0, tournament.Id, tournament.Name,
|
||||||
|
currentRule.ThirdFourthPoint, r.Rank)));
|
||||||
|
thirdFourth.ForEach(p => lesSacs.Remove(p.Player));
|
||||||
|
if (currentRule.Top8Point != 0)
|
||||||
|
{
|
||||||
|
Top8.ForEach(r =>
|
||||||
|
result.Results.Add(new Result(r.Player.Gamertag, tournament.Game?.Id ?? 0, tournament.Id, tournament.Name,
|
||||||
|
currentRule.Top8Point, r.Rank)));
|
||||||
|
Top8.ForEach(p => lesSacs.Remove(p.Player));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentRule.Top16Point != 0)
|
||||||
|
{
|
||||||
|
Top16.ForEach(r =>
|
||||||
|
result.Results.Add(
|
||||||
|
new Result(r.Player.Gamertag, tournament.Game?.Id ?? 0, tournament.Id, tournament.Name,
|
||||||
|
currentRule.Top16Point, r.Rank)));
|
||||||
|
Top16.ForEach(p => lesSacs.Remove(p.Player));
|
||||||
|
}
|
||||||
|
|
||||||
|
lesSacs.ForEach(r =>
|
||||||
|
result.Results.Add(new Result(r.Gamertag, tournament.Game?.Id ?? 0, tournament.Id, tournament.Name,
|
||||||
|
currentRule.Participation, tournament.Results.FirstOrDefault(e => e.Player == r)?.Rank ?? 999)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.Results.Any(e => e.GameId == 0))
|
||||||
|
{
|
||||||
|
result.Games.Add(new Game() { Id = 0, Name = "GAME NOT FOUND", LongName = "GAME NOT FOUND", Order = 999 });
|
||||||
|
}
|
||||||
|
|
||||||
|
var enumerable = result.Results.Select(e => e.GameId).Distinct();
|
||||||
|
result.Games = _context.Game.Where(g => enumerable.Contains(g.Id)).ToList();
|
||||||
|
|
||||||
|
System.Diagnostics.Trace.WriteLine(result.Results);
|
||||||
|
|
||||||
|
return await Task.FromResult(result);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Get Result For one Event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public async Task<TournamentsResult> GetEventResult(int id)
|
public async Task<TournamentsResult> GetEventResult(int id)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -272,11 +386,6 @@ namespace LaDOSE.Business.Service
|
|||||||
};
|
};
|
||||||
result.Participents.Add(x);
|
result.Participents.Add(x);
|
||||||
});
|
});
|
||||||
games.ForEach(e =>
|
|
||||||
{
|
|
||||||
e.Id = e.SmashId ?? e.Id;
|
|
||||||
result.Games.Add(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (var tournament in cevent.Tournaments.Where(e => e.Results != null && e.Results.Any()).ToList())
|
foreach (var tournament in cevent.Tournaments.Where(e => e.Results != null && e.Results.Any()).ToList())
|
||||||
{
|
{
|
||||||
@@ -310,7 +419,7 @@ namespace LaDOSE.Business.Service
|
|||||||
{
|
{
|
||||||
Top8.ForEach(r =>
|
Top8.ForEach(r =>
|
||||||
result.Results.Add(new Result(r.Player.Gamertag, tournament.Game?.Id??0, tournament.Id, tournament.Name,
|
result.Results.Add(new Result(r.Player.Gamertag, tournament.Game?.Id??0, tournament.Id, tournament.Name,
|
||||||
currentRule.ThirdFourthPoint, r.Rank)));
|
currentRule.Top8Point, r.Rank)));
|
||||||
Top8.ForEach(p => lesSacs.Remove(p.Player));
|
Top8.ForEach(p => lesSacs.Remove(p.Player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,13 +428,13 @@ namespace LaDOSE.Business.Service
|
|||||||
Top16.ForEach(r =>
|
Top16.ForEach(r =>
|
||||||
result.Results.Add(
|
result.Results.Add(
|
||||||
new Result(r.Player.Gamertag, tournament.Game?.Id??0, tournament.Id, tournament.Name,
|
new Result(r.Player.Gamertag, tournament.Game?.Id??0, tournament.Id, tournament.Name,
|
||||||
currentRule.ThirdFourthPoint, r.Rank)));
|
currentRule.Top16Point, r.Rank)));
|
||||||
Top16.ForEach(p => lesSacs.Remove(p.Player));
|
Top16.ForEach(p => lesSacs.Remove(p.Player));
|
||||||
}
|
}
|
||||||
|
|
||||||
lesSacs.ForEach(r =>
|
lesSacs.ForEach(r =>
|
||||||
result.Results.Add(new Result(r.Gamertag, tournament.Game?.Id??0, tournament.Id, tournament.Name,
|
result.Results.Add(new Result(r.Gamertag, tournament.Game?.Id??0, tournament.Id, tournament.Name,
|
||||||
currentRule.ThirdFourthPoint, tournament.Results.FirstOrDefault(e=>e.Player == r)?.Rank??999)));
|
currentRule.Participation, tournament.Results.FirstOrDefault(e=>e.Player == r)?.Rank??999)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,6 +443,9 @@ namespace LaDOSE.Business.Service
|
|||||||
result.Games.Add(new Game(){Id = 0,Name = "GAME NOT FOUND",LongName = "GAME NOT FOUND",Order = 999});
|
result.Games.Add(new Game(){Id = 0,Name = "GAME NOT FOUND",LongName = "GAME NOT FOUND",Order = 999});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var enumerable = result.Results.Select(e => e.GameId).Distinct();
|
||||||
|
result.Games = _context.Game.Where(g => enumerable.Contains(g.Id)).ToList();
|
||||||
|
|
||||||
System.Diagnostics.Trace.WriteLine(result.Results);
|
System.Diagnostics.Trace.WriteLine(result.Results);
|
||||||
|
|
||||||
return await Task.FromResult(result);
|
return await Task.FromResult(result);
|
||||||
|
|||||||
Reference in New Issue
Block a user