|
|
|
|
@ -420,7 +420,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
rotationIndex += 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let timeMatch = TimeMatch(matchID: match.id, rotationIndex: rotationIndex, courtIndex: match.courtIndex ?? 0, startDate: match.startDate!, durationLeft: match.matchFormat.getEstimatedDuration(additionalEstimationDuration), minimumBreakTime: match.matchFormat.breakTime.breakTime) |
|
|
|
|
let timeMatch = TimeMatch(matchID: match.id, rotationIndex: rotationIndex, matchRank: match.computedOrder, courtIndex: match.courtIndex ?? 0, startDate: match.startDate!, durationLeft: match.matchFormat.getEstimatedDuration(additionalEstimationDuration), minimumBreakTime: match.matchFormat.breakTime.breakTime) |
|
|
|
|
slots.append(timeMatch) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -534,7 +534,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
for i in 0..<rotationIndex { |
|
|
|
|
let courtsSorted = slots.filter { $0.rotationIndex == i }.map { $0.courtIndex }.sorted() |
|
|
|
|
let courts = randomizeCourts ? courtsSorted.shuffled() : courtsSorted |
|
|
|
|
var matches = slots.filter { $0.rotationIndex == i }.sorted(using: .keyPath(\.courtIndex)) |
|
|
|
|
var matches = slots.filter { $0.rotationIndex == i }.sorted(using: .keyPath(\.matchRank)) |
|
|
|
|
|
|
|
|
|
for j in 0..<matches.count { |
|
|
|
|
matches[j].courtIndex = courts[j] |
|
|
|
|
@ -621,6 +621,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
let timeMatch = TimeMatch( |
|
|
|
|
matchID: firstMatch.id, |
|
|
|
|
rotationIndex: rotationIndex, |
|
|
|
|
matchRank: firstMatch.computedOrder, |
|
|
|
|
courtIndex: courtIndex, |
|
|
|
|
startDate: rotationStartDate, |
|
|
|
|
durationLeft: firstMatch.matchFormat.getEstimatedDuration(additionalEstimationDuration), |
|
|
|
|
@ -858,6 +859,7 @@ struct GroupStageTimeMatch { |
|
|
|
|
public struct TimeMatch { |
|
|
|
|
let matchID: String |
|
|
|
|
let rotationIndex: Int |
|
|
|
|
let matchRank: Int |
|
|
|
|
var courtIndex: Int |
|
|
|
|
var startDate: Date |
|
|
|
|
var durationLeft: Int //in minutes |
|
|
|
|
|