|
|
|
|
@ -30,6 +30,7 @@ struct SchedulerView: View { |
|
|
|
|
List { |
|
|
|
|
switch destination { |
|
|
|
|
case .scheduleGroupStage: |
|
|
|
|
Section { |
|
|
|
|
MatchFormatPickingView(matchFormat: $tournament.groupStageMatchFormat) { |
|
|
|
|
Task { |
|
|
|
|
tournament.matchScheduler()?.updateSchedule(tournament: tournament) |
|
|
|
|
@ -48,6 +49,16 @@ struct SchedulerView: View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} footer: { |
|
|
|
|
if tournament.groupStageMatchFormat.weight > tournament.groupStageSmartMatchFormat().weight { |
|
|
|
|
Button { |
|
|
|
|
tournament.groupStageMatchFormat = tournament.groupStageSmartMatchFormat() |
|
|
|
|
} label: { |
|
|
|
|
Text("devrait être joué au moins en " + tournament.groupStageSmartMatchFormat().format + ", ") + Text("modifier ?").underline().foregroundStyle(.master) |
|
|
|
|
} |
|
|
|
|
.buttonStyle(.plain) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ForEach(tournament.groupStages()) { |
|
|
|
|
GroupStageScheduleEditorView(groupStage: $0, tournament: tournament) |
|
|
|
|
@ -63,6 +74,19 @@ struct SchedulerView: View { |
|
|
|
|
} |
|
|
|
|
.headerProminence(.increased) |
|
|
|
|
.monospacedDigit() |
|
|
|
|
.onChange(of: tournament.groupStageMatchFormat) { |
|
|
|
|
let groupStages = tournament.groupStages() |
|
|
|
|
tournament.groupStages().forEach { groupStage in |
|
|
|
|
groupStage.updateMatchFormat(tournament.groupStageMatchFormat) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
try dataStore.tournaments.addOrUpdate(instance: tournament) |
|
|
|
|
try dataStore.groupStages.addOrUpdate(contentOfs: groupStages) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ViewBuilder |
|
|
|
|
@ -92,8 +116,24 @@ struct SchedulerView: View { |
|
|
|
|
} |
|
|
|
|
} header: { |
|
|
|
|
Text(round.titleLabel()) |
|
|
|
|
} footer: { |
|
|
|
|
let federalFormat = tournament.roundSmartMatchFormat(round.index) |
|
|
|
|
if round.matchFormat.weight > federalFormat.weight { |
|
|
|
|
Button { |
|
|
|
|
round.updateMatchFormatAndAllMatches(federalFormat) |
|
|
|
|
do { |
|
|
|
|
try dataStore.rounds.addOrUpdate(instance: round) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} label: { |
|
|
|
|
Text("devrait être joué au moins en " + federalFormat.format + ", ") + Text("modifier ?").underline().foregroundStyle(.master) |
|
|
|
|
} |
|
|
|
|
.buttonStyle(.plain) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if round.index != 0 { |
|
|
|
|
Section { |
|
|
|
|
NavigationLink { |
|
|
|
|
LoserRoundScheduleEditorView(upperRound: round, tournament: tournament) |
|
|
|
|
@ -119,6 +159,24 @@ struct SchedulerView: View { |
|
|
|
|
} |
|
|
|
|
} header: { |
|
|
|
|
Text("Match de classement \(round.roundTitle(.short))") |
|
|
|
|
} footer: { |
|
|
|
|
if round.index == 1, let semi = round.loserRounds().first { |
|
|
|
|
let federalFormat = tournament.loserBracketSmartMatchFormat(1) |
|
|
|
|
if semi.matchFormat.weight > federalFormat.weight { |
|
|
|
|
Button { |
|
|
|
|
round.updateMatchFormatAndAllMatches(federalFormat) |
|
|
|
|
do { |
|
|
|
|
try dataStore.rounds.addOrUpdate(instance: round) |
|
|
|
|
} catch { |
|
|
|
|
Logger.error(error) |
|
|
|
|
} |
|
|
|
|
} label: { |
|
|
|
|
Text("devrait être joué au moins en " + federalFormat.format + ", ") + Text("modifier ?").underline().foregroundStyle(.master) |
|
|
|
|
} |
|
|
|
|
.buttonStyle(.plain) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|