possiblité de lancer l'horaire intelligent sur tous les tournois d'un evenement en une fois

newoffer2025
Razmig Sarkissian 3 months ago
parent beaab645b9
commit 4579ced7a2
  1. 3
      PadelClubData/Data/MatchScheduler.swift
  2. 17
      PadelClubData/Data/Tournament.swift
  3. 4
      PadelClubData/Extensions/Date+Extensions.swift

@ -138,7 +138,6 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable {
} }
public func groupStageDispatcher(groupStages: [GroupStage], startingDate: Date) -> GroupStageMatchDispatcher { public func groupStageDispatcher(groupStages: [GroupStage], startingDate: Date) -> GroupStageMatchDispatcher {
let _groupStages = groupStages let _groupStages = groupStages
// Get the maximum count of matches in any group // Get the maximum count of matches in any group
@ -839,7 +838,7 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable {
} }
if tournament.dayDuration > 1 && (lastDate.timeOfDay == .evening || errorFormat) { if tournament.dayDuration > 1 && (lastDate.timeOfDay == .evening || lastDate.timeOfDay == .night || errorFormat) {
bracketStartDate = lastDate.tomorrowAtNine bracketStartDate = lastDate.tomorrowAtNine
} }

@ -2386,6 +2386,23 @@ defer {
return federalTournamentAge.minimumNumberOfTeams(inCategory: tournamentCategory, andInLevel: tournamentLevel) return federalTournamentAge.minimumNumberOfTeams(inCategory: tournamentCategory, andInLevel: tournamentLevel)
} }
public func removeAllDates() {
let allMatches = allMatches()
allMatches.forEach({
$0.startDate = nil
$0.confirmed = false
})
self.tournamentStore?.matches.addOrUpdate(contentOfs: allMatches)
let allGroupStages = groupStages()
allGroupStages.forEach({ $0.startDate = nil })
self.tournamentStore?.groupStages.addOrUpdate(contentOfs: allGroupStages)
let allRounds = allRounds()
allRounds.forEach({ $0.startDate = nil })
self.tournamentStore?.rounds.addOrUpdate(contentOfs: allRounds)
}
// MARK: - // MARK: -
func insertOnServer() throws { func insertOnServer() throws {

@ -214,6 +214,10 @@ public extension Date {
Calendar.current.component(.day, from: self) Calendar.current.component(.day, from: self)
} }
var hourInt: Int {
Calendar.current.component(.hour, from: self)
}
var startOfDay: Date { var startOfDay: Date {
Calendar.current.startOfDay(for: self) Calendar.current.startOfDay(for: self)
} }

Loading…
Cancel
Save