main
Razmig Sarkissian 4 weeks ago
parent b41e8064d7
commit 45319790aa
  1. 6
      PadelClub/Views/Tournament/Screen/Components/HeadManagerView.swift
  2. 8
      PadelClub/Views/Tournament/Screen/Components/TournamentMatchFormatsSettingsView.swift
  3. 4
      PadelClub/Views/Tournament/Screen/TableStructureView.swift

@ -62,7 +62,9 @@ struct HeadManagerView: View {
} }
while leftToPlace(heads: heads, teamsPerRound: teamsPerRound) > 0 { while leftToPlace(heads: heads, teamsPerRound: teamsPerRound) > 0 {
// maxAssignable: On retire toutes les équipes placées dans les tours précédents, pondérées par leur propagation (puissance du tour) // maxAssignable: On retire toutes les équipes placées dans les tours précédents, pondérées par leur propagation (puissance du tour)
let headsLeft = heads - teamsPerRound.reduce(0, +) let alreadyPut = teamsPerRound.reduce(0, +)
let headsLeft = alreadyPut == 0 ? teamsInBracket : heads - alreadyPut
// Calculate how many teams from previous rounds propagate to this round // Calculate how many teams from previous rounds propagate to this round
let currentRound = teamsPerRound.count let currentRound = teamsPerRound.count
var previousTeams = 0 var previousTeams = 0
@ -150,7 +152,7 @@ struct HeadManagerView: View {
} }
result = RoundRule.cumulatedNumberOfMatches(forTeams: count) result = RoundRule.cumulatedNumberOfMatches(forTeams: count)
} }
print(index, value, result, count)
return result return result
} }
.reduce(0, +) .reduce(0, +)

@ -25,12 +25,10 @@ struct TournamentMatchFormatsSettingsView: View {
var body: some View { var body: some View {
@Bindable var tournament = tournament @Bindable var tournament = tournament
List { List {
if confirmUpdate { RowButtonView("Modifier les matchs existants", role: .destructive) {
RowButtonView("Modifier les matchs existants", role: .destructive) { _updateAllFormat()
_updateAllFormat()
}
} }
TournamentFormatSelectionView() TournamentFormatSelectionView()
Section { Section {

@ -691,6 +691,10 @@ struct TableStructureView: View {
let seedSorted = frenchUmpireOrder(for: numberOfMatches).filter({ index in let seedSorted = frenchUmpireOrder(for: numberOfMatches).filter({ index in
playedMatches.contains(index) playedMatches.contains(index)
}).prefix(seedCount) }).prefix(seedCount)
if playedMatches.count == numberOfMatches && seedCount == numberOfMatches * 2 {
continue
}
for (index, value) in seedSorted.enumerated() { for (index, value) in seedSorted.enumerated() {
let isOpponentTurn = index >= playedMatches.count let isOpponentTurn = index >= playedMatches.count
if let match = allMatches[safe:value] { if let match = allMatches[safe:value] {

Loading…
Cancel
Save