|
|
|
|
@ -31,6 +31,15 @@ final public class Match: BaseMatch, SideStorable { |
|
|
|
|
plannedStartDate = startDate |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public func updateStartDate(_ date: Date?, keepPlannedStartDate: Bool) { |
|
|
|
|
DataStore.shared.resetOngoingCache() |
|
|
|
|
let cachedPlannedStartDate = self.plannedStartDate |
|
|
|
|
self.startDate = date |
|
|
|
|
if keepPlannedStartDate { |
|
|
|
|
self.plannedStartDate = cachedPlannedStartDate |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MARK: - |
|
|
|
|
|
|
|
|
|
public func setMatchName(_ serverName: String?) { |
|
|
|
|
@ -194,7 +203,7 @@ defer { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public func cleanScheduleAndSave(_ targetStartDate: Date? = nil) { |
|
|
|
|
startDate = targetStartDate |
|
|
|
|
updateStartDate(targetStartDate, keepPlannedStartDate: true) |
|
|
|
|
confirmed = false |
|
|
|
|
endDate = nil |
|
|
|
|
followingMatch()?.cleanScheduleAndSave(nil) |
|
|
|
|
@ -652,7 +661,7 @@ defer { |
|
|
|
|
|
|
|
|
|
public func validateMatch(fromStartDate: Date, toEndDate: Date, fieldSetup: MatchFieldSetup, forced: Bool = false) { |
|
|
|
|
if hasEnded() == false { |
|
|
|
|
startDate = fromStartDate |
|
|
|
|
updateStartDate(fromStartDate, keepPlannedStartDate: true) |
|
|
|
|
|
|
|
|
|
switch fieldSetup { |
|
|
|
|
case .fullRandom: |
|
|
|
|
@ -669,7 +678,7 @@ defer { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
startDate = fromStartDate |
|
|
|
|
updateStartDate(fromStartDate, keepPlannedStartDate: true) |
|
|
|
|
endDate = toEndDate |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|