Skip to content

Commit

Permalink
added this auto-fix option back in, fixed note create in main
Browse files Browse the repository at this point in the history
  • Loading branch information
aapis committed Jan 12, 2023
1 parent 78f97eb commit 1cb8128
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DLPrototype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 51;
CURRENT_PROJECT_VERSION = 52;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand All @@ -867,7 +867,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 51;
CURRENT_PROJECT_VERSION = 52;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DLPrototype/Preview Content\"";
DEVELOPMENT_TEAM = 6DT7L2N5X6;
Expand Down
3 changes: 1 addition & 2 deletions DLPrototype/Views/Notes/NoteCreate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ struct NoteCreate: View {
note.postedDate = Date()
note.id = UUID()
note.job = selectedJob
print(note.job?.jid)

// PersistenceController.shared.save()
PersistenceController.shared.save()
}
}

Expand Down
20 changes: 19 additions & 1 deletion DLPrototype/Views/Today/Today.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,31 @@ struct Today : View, Identifiable {
@State private var logTableId: UUID = UUID()

@AppStorage("showExperimentalFeatures") private var showExperimentalFeatures = false
@AppStorage("autoFixJobs") public var autoFixJobs: Bool = false

@FetchRequest(
sortDescriptors: [
SortDescriptor(\.timestamp, order: .reverse)
],
predicate: NSPredicate(format: "timestamp > %@ && timestamp <= %@", DateHelper.thisAm(), DateHelper.tomorrow())
) public var today: FetchedResults<LogRecord>
) public var rawToday: FetchedResults<LogRecord>

private var today: FetchedResults<LogRecord> {
if showExperimentalFeatures {
if autoFixJobs {
let defaultJob = CoreDataJob(moc: moc).byId(11.0)
for rec in rawToday {
if rec.job == nil {
rec.job = defaultJob

PersistenceController.shared.save()
}
}
}
}

return rawToday
}

@Environment(\.managedObjectContext) var moc
@EnvironmentObject public var recordsModel: LogRecords
Expand Down

0 comments on commit 1cb8128

Please sign in to comment.