diff --git a/DLPrototype.xcodeproj/project.pbxproj b/DLPrototype.xcodeproj/project.pbxproj index d5eb679f..79e64b9d 100644 --- a/DLPrototype.xcodeproj/project.pbxproj +++ b/DLPrototype.xcodeproj/project.pbxproj @@ -1450,7 +1450,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 143; + CURRENT_PROJECT_VERSION = 144; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\""; DEVELOPMENT_TEAM = 6DT7L2N5X6; @@ -1485,7 +1485,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 143; + CURRENT_PROJECT_VERSION = 144; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\""; DEVELOPMENT_TEAM = 6DT7L2N5X6; diff --git a/DLPrototype/Models/CoreData/CoreDataJob.swift b/DLPrototype/Models/CoreData/CoreDataJob.swift index 8b884877..ef995ae4 100644 --- a/DLPrototype/Models/CoreData/CoreDataJob.swift +++ b/DLPrototype/Models/CoreData/CoreDataJob.swift @@ -34,7 +34,6 @@ public class CoreDataJob: ObservableObject { let fetch: NSFetchRequest = Job.fetchRequest() fetch.predicate = NSPredicate(format: "alive == true && project != nil && project.alive == true") fetch.sortDescriptors = [ - NSSortDescriptor(keyPath: \Job.project?, ascending: false), NSSortDescriptor(keyPath: \Job.lastUpdate?, ascending: false), NSSortDescriptor(keyPath: \Job.jid, ascending: false) ] diff --git a/DLPrototype/Views/Jobs/JobCreate.swift b/DLPrototype/Views/Jobs/JobCreate.swift index 2c9a8916..f1d793b5 100644 --- a/DLPrototype/Views/Jobs/JobCreate.swift +++ b/DLPrototype/Views/Jobs/JobCreate.swift @@ -133,6 +133,7 @@ extension JobCreate { newJob.jid = Double(id)! } + newJob.id = UUID() newJob.alive = alive newJob.shredable = shredable newJob.colour = colourAsDouble @@ -145,13 +146,13 @@ extension JobCreate { // TODO: workaround is to redirect to project instead if validProject { if let proj = project { - nav.setView(AnyView(ProjectView(project: proj))) + proj.addToJobs(newJob) + newJob.project = proj + + nav.setView(AnyView(JobDashboard())) nav.setId() - nav.setParent(.projects) - nav.setSidebar(AnyView(ProjectsDashboardSidebar())) - // TODO: for some reason this throws an "unrecognized selector" exception, investigate -// proj.addToJobs(newJob) -// newJob.project = proj + nav.setParent(.jobs) + nav.setSidebar(AnyView(JobDashboardSidebar())) } } } diff --git a/DLPrototype/Views/Jobs/JobView.swift b/DLPrototype/Views/Jobs/JobView.swift index 314a9e9d..095ab96e 100644 --- a/DLPrototype/Views/Jobs/JobView.swift +++ b/DLPrototype/Views/Jobs/JobView.swift @@ -174,6 +174,10 @@ struct JobView: View { job.jid = Double(id)! } + if job.id == nil { + job.id = UUID() + } + job.alive = alive job.shredable = shredable