05/05 Update the API to follow-up and resinspection
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user