From 888e02581a4e60eef33949b2880bcee9a8abae01 Mon Sep 17 00:00:00 2001 From: Raz Date: Thu, 22 May 2025 15:36:47 +0200 Subject: [PATCH] v1.2.30 --- PadelClubData/Data/MatchScheduler.swift | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PadelClubData/Data/MatchScheduler.swift b/PadelClubData/Data/MatchScheduler.swift index 242a6a2..a5e5ee7 100644 --- a/PadelClubData/Data/MatchScheduler.swift +++ b/PadelClubData/Data/MatchScheduler.swift @@ -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)