|
|
|
|
@ -238,6 +238,8 @@ struct TableStructureView: View { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if selectedTournament == nil { |
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
if groupStageCount > 0 { |
|
|
|
|
if structurePreset != .doubleGroupStage { |
|
|
|
|
@ -267,13 +269,13 @@ struct TableStructureView: View { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if groupStageCount > 0 { |
|
|
|
|
// LabeledContent { |
|
|
|
|
// Text(tf.formatted()) |
|
|
|
|
// } label: { |
|
|
|
|
// Text("Effectif tableau") |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// if groupStageCount > 0 { |
|
|
|
|
// LabeledContent { |
|
|
|
|
// Text(tf.formatted()) |
|
|
|
|
// } label: { |
|
|
|
|
// Text("Effectif tableau") |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
} else { |
|
|
|
|
LabeledContent { |
|
|
|
|
let mp1 = teamsPerGroupStage * (teamsPerGroupStage - 1) / 2 * groupStageCount |
|
|
|
|
@ -326,7 +328,7 @@ struct TableStructureView: View { |
|
|
|
|
Text("Vous pourrez ensuite modifier le nombre de tour dans l'écran de réglages du tableau.") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if tournament.state() != .initial { |
|
|
|
|
if seedRepartition.isEmpty == false { |
|
|
|
|
@ -661,7 +663,7 @@ struct TableStructureView: View { |
|
|
|
|
tournament.tournamentStore?.matches.addOrUpdate(contentOfs: tournament._allMatchesIncludingDisabled()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if seedRepartition.count > 0 { |
|
|
|
|
if seedRepartition.count > 0, selectedTournament == nil { |
|
|
|
|
await _handleSeedRepartition() |
|
|
|
|
} |
|
|
|
|
} else if (rebuildEverything == false && requirements.contains(.groupStage)) { |
|
|
|
|
@ -683,13 +685,16 @@ struct TableStructureView: View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private func _handleSeedRepartition() async { |
|
|
|
|
while tournament.rounds().count < seedRepartition.count { |
|
|
|
|
await tournament.addNewRound(tournament.rounds().count) |
|
|
|
|
let rounds = tournament.rounds() |
|
|
|
|
var roundsCount = rounds.count |
|
|
|
|
while roundsCount < seedRepartition.count { |
|
|
|
|
await tournament.addNewRound(roundsCount) |
|
|
|
|
roundsCount += 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if seedRepartition.reduce(0, +) > 0 { |
|
|
|
|
let rounds = tournament.rounds() |
|
|
|
|
let roundsToDelete = rounds.suffix(rounds.count - seedRepartition.count) |
|
|
|
|
let roundsToDelete = rounds.prefix(rounds.count - seedRepartition.count) |
|
|
|
|
for round in roundsToDelete { |
|
|
|
|
await tournament.removeRound(round) |
|
|
|
|
} |
|
|
|
|
|