|
|
|
@ -1175,18 +1175,35 @@ class Tournament : ModelObject, Storable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func deleteStructure() { |
|
|
|
func deleteStructure() { |
|
|
|
try? DataStore.shared.rounds.delete(contentOfs: rounds()) |
|
|
|
do { |
|
|
|
|
|
|
|
try DataStore.shared.rounds.delete(contentOfs: rounds()) |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
Logger.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
unsortedTeams().forEach({ $0.bracketPosition = nil }) |
|
|
|
unsortedTeams().forEach({ $0.bracketPosition = nil }) |
|
|
|
try? DataStore.shared.teamRegistrations.addOrUpdate(contentOfs: unsortedTeams()) |
|
|
|
do { |
|
|
|
|
|
|
|
try DataStore.shared.teamRegistrations.addOrUpdate(contentOfs: unsortedTeams()) |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
Logger.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func deleteGroupStages() { |
|
|
|
func deleteGroupStages() { |
|
|
|
try? DataStore.shared.groupStages.delete(contentOfs: groupStages()) |
|
|
|
do { |
|
|
|
unsortedTeams().forEach({ |
|
|
|
try DataStore.shared.groupStages.delete(contentOfs: groupStages()) |
|
|
|
$0.groupStage = nil |
|
|
|
} catch { |
|
|
|
$0.groupStagePosition = nil |
|
|
|
Logger.error(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
try? DataStore.shared.teamRegistrations.addOrUpdate(contentOfs: unsortedTeams()) |
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
unsortedTeams().forEach({ |
|
|
|
|
|
|
|
$0.groupStage = nil |
|
|
|
|
|
|
|
$0.groupStagePosition = nil |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
try DataStore.shared.teamRegistrations.addOrUpdate(contentOfs: unsortedTeams()) |
|
|
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
Logger.error(error) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func refreshGroupStages() { |
|
|
|
func refreshGroupStages() { |
|
|
|
|