main
Razmig Sarkissian 4 weeks ago
parent b41e8064d7
commit 45319790aa
  1. 6
      PadelClub/Views/Tournament/Screen/Components/HeadManagerView.swift
  2. 2
      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 {
// 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
let currentRound = teamsPerRound.count
var previousTeams = 0
@ -150,7 +152,7 @@ struct HeadManagerView: View {
}
result = RoundRule.cumulatedNumberOfMatches(forTeams: count)
}
print(index, value, result, count)
return result
}
.reduce(0, +)

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

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

Loading…
Cancel
Save