|
|
|
|
@ -30,6 +30,14 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
return Store.main.findById(tournament) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func getGroupStageRotationDifference() -> Int { |
|
|
|
|
if rotationDifferenceIsImportant { |
|
|
|
|
return groupStageRotationDifference |
|
|
|
|
} else { |
|
|
|
|
return 0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@discardableResult |
|
|
|
|
public func updateGroupStageSchedule(tournament: Tournament, specificGroupStage: GroupStage? = nil, atStep step: Int = 0, startDate: Date? = nil) -> Date { |
|
|
|
|
let computedGroupStageChunkCount = groupStageChunkCount ?? tournament.getGroupStageChunkValue() |
|
|
|
|
@ -75,7 +83,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
|
|
|
|
|
var timeIntervalToAdd = (Double(matchSchedule.rotationIndex)) * Double(estimatedDuration) * 60 |
|
|
|
|
|
|
|
|
|
timeIntervalToAdd += Double(matchSchedule.rotationIndex) * Double(self.groupStageRotationDifference) * Double(match.matchFormat.getEstimatedDuration(tournament.additionalEstimationDuration)) * 60 |
|
|
|
|
timeIntervalToAdd += Double(matchSchedule.rotationIndex) * Double(self.getGroupStageRotationDifference()) * Double(match.matchFormat.getEstimatedDuration(tournament.additionalEstimationDuration)) * 60 |
|
|
|
|
|
|
|
|
|
if let startDate = match.groupStageObject?.startDate { |
|
|
|
|
let matchStartDate = startDate.addingTimeInterval(timeIntervalToAdd) |
|
|
|
|
@ -107,7 +115,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
|
|
|
|
|
var timeIntervalToAdd = (Double(matchSchedule.rotationIndex)) * Double(estimatedDuration) * 60 |
|
|
|
|
|
|
|
|
|
timeIntervalToAdd += Double(matchSchedule.rotationIndex) * Double(self.groupStageRotationDifference) * Double(match.matchFormat.getEstimatedDuration(tournament.additionalEstimationDuration)) * 60 |
|
|
|
|
timeIntervalToAdd += Double(matchSchedule.rotationIndex) * Double(self.getGroupStageRotationDifference()) * Double(match.matchFormat.getEstimatedDuration(tournament.additionalEstimationDuration)) * 60 |
|
|
|
|
|
|
|
|
|
if let startDate = match.groupStageObject?.startDate { |
|
|
|
|
let matchStartDate = startDate.addingTimeInterval(timeIntervalToAdd) |
|
|
|
|
@ -193,7 +201,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable { |
|
|
|
|
|
|
|
|
|
var timeIntervalToAdd = (Double(rotationIndex)) * Double(estimatedDuration) * 60 |
|
|
|
|
|
|
|
|
|
timeIntervalToAdd += Double(rotationIndex) * Double(self.groupStageRotationDifference) * Double(match.matchFormat.getEstimatedDuration(additionalEstimationDuration)) * 60 |
|
|
|
|
timeIntervalToAdd += Double(rotationIndex) * Double(self.getGroupStageRotationDifference()) * Double(match.matchFormat.getEstimatedDuration(additionalEstimationDuration)) * 60 |
|
|
|
|
|
|
|
|
|
let rotationStartDate: Date = startingDate.addingTimeInterval(timeIntervalToAdd) |
|
|
|
|
|
|
|
|
|
|