Skip to content

Commit

Permalink
Merge pull request #179 from aapis/bugfix/job-create-fails
Browse files Browse the repository at this point in the history
Fix job creation failure
  • Loading branch information
aapis authored Sep 1, 2023
2 parents 19d7c83 + 831611b commit 1194345
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DLPrototype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion DLPrototype/Models/CoreData/CoreDataJob.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class CoreDataJob: ObservableObject {
let fetch: NSFetchRequest<Job> = 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)
]
Expand Down
13 changes: 7 additions & 6 deletions DLPrototype/Views/Jobs/JobCreate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ extension JobCreate {
newJob.jid = Double(id)!
}

newJob.id = UUID()
newJob.alive = alive
newJob.shredable = shredable
newJob.colour = colourAsDouble
Expand All @@ -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()))
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions DLPrototype/Views/Jobs/JobView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ struct JobView: View {
job.jid = Double(id)!
}

if job.id == nil {
job.id = UUID()
}

job.alive = alive
job.shredable = shredable

Expand Down

0 comments on commit 1194345

Please sign in to comment.