|
|
|
@ -503,17 +503,26 @@ defer { |
|
|
|
if isUpperBracket() { |
|
|
|
if isUpperBracket() { |
|
|
|
if index == 0 { return SeedInterval(first: 1, last: 2) } |
|
|
|
if index == 0 { return SeedInterval(first: 1, last: 2) } |
|
|
|
let initialMatchIndexFromRoundIndex = RoundRule.matchIndex(fromRoundIndex: index) |
|
|
|
let initialMatchIndexFromRoundIndex = RoundRule.matchIndex(fromRoundIndex: index) |
|
|
|
let seedsAfterThisRound : [TeamRegistration] = self.tournamentStore.teamRegistrations.filter { |
|
|
|
|
|
|
|
$0.bracketPosition != nil |
|
|
|
|
|
|
|
&& ($0.bracketPosition! / 2) < initialMatchIndexFromRoundIndex |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let playedMatches = playedMatches().count |
|
|
|
if initialMode { |
|
|
|
let minimumMatches = initialMode ? RoundRule.numberOfMatches(forRoundIndex: index) : playedMatches * 2 |
|
|
|
let playedMatches = RoundRule.numberOfMatches(forRoundIndex: index) |
|
|
|
//print("playedMatches \(playedMatches)", initialMode, parent, parentRound?.roundTitle(), seedsAfterThisRound.count) |
|
|
|
let seedInterval = SeedInterval(first: playedMatches + 1, last: playedMatches * 2) |
|
|
|
let seedInterval = SeedInterval(first: playedMatches + seedsAfterThisRound.count + 1, last: minimumMatches + seedsAfterThisRound.count) |
|
|
|
//print(seedInterval.localizedLabel()) |
|
|
|
//print(seedInterval.localizedLabel()) |
|
|
|
return seedInterval |
|
|
|
return seedInterval |
|
|
|
} else { |
|
|
|
|
|
|
|
let seedsAfterThisRound : [TeamRegistration] = self.tournamentStore.teamRegistrations.filter { |
|
|
|
|
|
|
|
$0.bracketPosition != nil |
|
|
|
|
|
|
|
&& ($0.bracketPosition! / 2) < initialMatchIndexFromRoundIndex |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let playedMatches = playedMatches().count |
|
|
|
|
|
|
|
let minimumMatches = playedMatches * 2 |
|
|
|
|
|
|
|
//print("playedMatches \(playedMatches)", initialMode, parent, parentRound?.roundTitle(), seedsAfterThisRound.count) |
|
|
|
|
|
|
|
let seedInterval = SeedInterval(first: playedMatches + seedsAfterThisRound.count + 1, last: minimumMatches + seedsAfterThisRound.count) |
|
|
|
|
|
|
|
//print(seedInterval.localizedLabel()) |
|
|
|
|
|
|
|
return seedInterval |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if let previousRound = previousRound() { |
|
|
|
if let previousRound = previousRound() { |
|
|
|
|