Merge branch 'wip_main'

#Conflicts:
#	PadelClub/Views/Planning/Components/DateUpdateManagerView.swift
sync2
Raz 1 year ago
commit d059002342
  1. 7
      PadelClub/Data/MatchScheduler.swift
  2. 3
      PadelClub/Views/Planning/GroupStageScheduleEditorView.swift

@ -93,9 +93,12 @@ final class MatchScheduler : ModelObject, Storable {
} }
@discardableResult @discardableResult
func updateGroupStageSchedule(tournament: Tournament) -> Date { func updateGroupStageSchedule(tournament: Tournament, specificGroupStage: GroupStage? = nil) -> Date {
let computedGroupStageChunkCount = groupStageChunkCount ?? tournament.getGroupStageChunkValue() let computedGroupStageChunkCount = groupStageChunkCount ?? tournament.getGroupStageChunkValue()
let groupStages: [GroupStage] = tournament.groupStages() var groupStages: [GroupStage] = tournament.groupStages()
if let specificGroupStage {
groupStages = [specificGroupStage]
}
let numberOfCourtsAvailablePerRotation: Int = tournament.courtCount let numberOfCourtsAvailablePerRotation: Int = tournament.courtCount
let matches = groupStages.flatMap { $0._matches() } let matches = groupStages.flatMap { $0._matches() }

@ -27,8 +27,9 @@ struct GroupStageScheduleEditorView: View {
} }
var body: some View { var body: some View {
DatePickingView(title: groupStage.groupStageTitle(), startDate: $startDate, currentDate: $groupStage.startDate, duration: groupStage.matchFormat.getEstimatedDuration(tournament.additionalEstimationDuration)) { GroupStageDatePickingView(title: groupStage.groupStageTitle(), startDate: $startDate, currentDate: $groupStage.startDate, duration: groupStage.matchFormat.getEstimatedDuration(tournament.additionalEstimationDuration)) {
groupStage.startDate = startDate groupStage.startDate = startDate
tournament.matchScheduler()?.updateGroupStageSchedule(tournament: tournament, specificGroupStage: groupStage)
_save() _save()
} }
} }

Loading…
Cancel
Save