Ajout de l'algorithme pour gérer les sacs.
This commit is contained in:
@@ -83,28 +83,26 @@
|
|||||||
|
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
||||||
<StackPanel Grid.Row="2" Grid.Column="2">
|
<DockPanel Grid.Row="2" Grid.Column="2" >
|
||||||
<TextBlock>Resultat :</TextBlock>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
|
||||||
<TextBlock> First : </TextBlock>
|
<TextBlock> Total :</TextBlock>
|
||||||
<TextBlock Text="{Binding First,UpdateSourceTrigger=PropertyChanged}"> </TextBlock>
|
<TextBlock Text="{Binding SelectedGameResult.Count,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Vertical">
|
<ListView ItemsSource="{Binding SelectedGameResult}" Margin="5,5,5,5"
|
||||||
<TextBlock> Result :</TextBlock>
|
IsTextSearchEnabled="True" TextSearch.TextPath="Name">
|
||||||
<ListView Grid.Row="2" Grid.Column="1" ItemsSource="{Binding SelectedGameResult}" Margin="5,5,5,5"
|
<ListView.ItemTemplate>
|
||||||
IsTextSearchEnabled="True" TextSearch.TextPath="Name">
|
<DataTemplate>
|
||||||
<ListView.ItemTemplate>
|
<StackPanel Orientation="Horizontal">
|
||||||
<DataTemplate>
|
<TextBlock Margin="5,0,0,0" Text="{Binding Player}" />
|
||||||
<StackPanel Orientation="Horizontal">
|
<TextBlock Margin="5,0,0,0" Text="{Binding Point}" />
|
||||||
<TextBlock Margin="5,0,0,0" Text="{Binding Player}" />
|
</StackPanel>
|
||||||
<TextBlock Margin="5,0,0,0" Text="{Binding Point}" />
|
</DataTemplate>
|
||||||
</StackPanel>
|
</ListView.ItemTemplate>
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
|
|
||||||
</ListView>
|
</ListView>
|
||||||
</StackPanel>
|
</DockPanel>
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -73,13 +73,20 @@ namespace LaDOSE.Business.Provider
|
|||||||
var participentResults = await new ParticipantsQuery(){tournamentID = idTournament }.call(ApiCaller);
|
var participentResults = await new ParticipantsQuery(){tournamentID = idTournament }.call(ApiCaller);
|
||||||
|
|
||||||
List<Participent> participants = new List<Participent>();
|
List<Participent> participants = new List<Participent>();
|
||||||
participentResults.ForEach(w => participants.Add(new Participent()
|
participentResults.ForEach(w =>
|
||||||
{
|
{
|
||||||
Id = w.id,
|
if (w.active)
|
||||||
Name = w.name,
|
{
|
||||||
Rank = w.final_rank,
|
participants.Add(new Participent()
|
||||||
IsMember = true,
|
{
|
||||||
}));
|
Id = w.id,
|
||||||
|
Name = w.name,
|
||||||
|
Rank = w.final_rank,
|
||||||
|
IsMember = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
return participants;
|
return participants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace LaDOSE.Business.Service
|
|||||||
public int Top8Point { get; set; }
|
public int Top8Point { get; set; }
|
||||||
public int Top16Point { 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)
|
public Rules(int playerMin, int playerMax, int firstPoint, int secondPoint, int thirdFourthPoint, int top8Point, int top16Point)
|
||||||
{
|
{
|
||||||
PlayerMin = playerMin;
|
PlayerMin = playerMin;
|
||||||
@@ -31,6 +33,7 @@ namespace LaDOSE.Business.Service
|
|||||||
ThirdFourthPoint = thirdFourthPoint;
|
ThirdFourthPoint = thirdFourthPoint;
|
||||||
Top8Point = top8Point;
|
Top8Point = top8Point;
|
||||||
Top16Point = top16Point;
|
Top16Point = top16Point;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,6 +100,10 @@ namespace LaDOSE.Business.Service
|
|||||||
tournament.Game = game;
|
tournament.Game = game;
|
||||||
|
|
||||||
var playerCount = tournament.Participents.Count;
|
var playerCount = tournament.Participents.Count;
|
||||||
|
//Suppression des forfait
|
||||||
|
|
||||||
|
|
||||||
|
var lesSacs = tournament.Participents;
|
||||||
var currentRule = TournamentRules.FirstOrDefault(rules =>
|
var currentRule = TournamentRules.FirstOrDefault(rules =>
|
||||||
rules.PlayerMin < playerCount && rules.PlayerMax >= playerCount
|
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();
|
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));
|
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));
|
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(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(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(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();
|
result.Games = tournaments.Select(e => e.Game).ToList();
|
||||||
|
|||||||
Reference in New Issue
Block a user