fix issue with groupstage start date

sync3
Razmig Sarkissian 5 months ago
parent e5f7cbfcd1
commit fae2e79207
  1. 4
      PadelClubData/Data/GroupStage.swift
  2. 3
      PadelClubData/Data/MatchScheduler.swift

@ -607,6 +607,10 @@ final public class GroupStage: BaseGroupStage, SideStorable {
return teams(true).firstIndex(of: team) return teams(true).firstIndex(of: team)
} }
public func computedStartDate() -> Date? {
return _matches().sorted(by: \.computedStartDateForSorting).first?.startDate
}
public override func deleteDependencies(store: Store, shouldBeSynchronized: Bool) { public override func deleteDependencies(store: Store, shouldBeSynchronized: Bool) {
store.deleteDependencies(type: Match.self, shouldBeSynchronized: shouldBeSynchronized) { $0.groupStage == self.id } store.deleteDependencies(type: Match.self, shouldBeSynchronized: shouldBeSynchronized) { $0.groupStage == self.id }

@ -131,6 +131,9 @@ final public class MatchScheduler: BaseMatchScheduler, SideStorable {
} catch { } catch {
Logger.error(error) Logger.error(error)
} }
groupStages.forEach({ $0.startDate = $0.computedStartDate() })
self.tournamentStore?.groupStages.addOrUpdate(contentOfs: groupStages)
return lastDate return lastDate
} }

Loading…
Cancel
Save