05/05 Update the API to follow-up and resinspection

This commit is contained in:
Nguyen Ngo
2026-05-05 18:19:31 -04:00
parent 9d6b5e5bcb
commit b9e504b72c
8 changed files with 342 additions and 18 deletions
+13
View File
@@ -134,6 +134,19 @@ class SyncManager: ObservableObject {
inspection.serverId = inspectionId
inspection.syncStatus = "synced"
inspection.status = "synced"
// Clear follow-up flag on parent
// Use parentLocalId (always set at creation) rather than
// parentServerId (nil until parent syncs) so the badge clears
// regardless of whether the parent has been synced yet.
if let parentLocalId = inspection.parentLocalId {
let allInspections = try? context.fetch(FetchDescriptor<LocalInspection>())
if let parent = allInspections?.first(where: { $0.localId == parentLocalId }) {
parent.followUpRequired = false
parent.followUpNote = nil
}
}
try? context.save()
} catch {