|
|
|
|
@ -1941,9 +1941,11 @@ defer { |
|
|
|
|
return bracketTeamCount |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func buildBracket() { |
|
|
|
|
func buildBracket(minimalBracketTeamCount: Int? = nil) { |
|
|
|
|
guard rounds().isEmpty else { return } |
|
|
|
|
let roundCount = RoundRule.numberOfRounds(forTeams: bracketTeamCount()) |
|
|
|
|
let roundCount = RoundRule.numberOfRounds(forTeams: minimalBracketTeamCount ?? bracketTeamCount()) |
|
|
|
|
let matchCount = RoundRule.numberOfMatches(forTeams: minimalBracketTeamCount ?? bracketTeamCount()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let rounds = (0..<roundCount).map { //index 0 is the final |
|
|
|
|
return Round(tournament: id, index: $0, matchFormat: roundSmartMatchFormat($0), loserBracketMode: loserBracketMode) |
|
|
|
|
@ -1958,7 +1960,6 @@ defer { |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
let matchCount = RoundRule.numberOfMatches(forTeams: bracketTeamCount()) |
|
|
|
|
|
|
|
|
|
let matches = (0..<matchCount).map { //0 is final match |
|
|
|
|
let roundIndex = RoundRule.roundIndex(fromMatchIndex: $0) |
|
|
|
|
|