Jul 30 - Update iPad - inspector can re-inspect and create follow-up

This commit is contained in:
Nguyen Ngo
2026-07-30 16:16:15 -04:00
parent b7990cc9ba
commit dac7e6c597
16 changed files with 961 additions and 19 deletions
@@ -38,6 +38,16 @@ final class LocalScheduledInspection {
var isOverdue: Bool
var notes: String?
/// Server ID of the inspection this schedule is a planned follow-up of
/// (phase45). Carried onto the `LocalInspection` as `parentServerId` when
/// the inspector starts it, so the run lands as a linked re-inspection
/// rather than an ordinary scheduled one.
///
/// Optional, so SwiftData migrates lightweight without a plan (rule 46);
/// nil for an ordinary schedule and for every row pulled from a
/// pre-phase45 server.
var parentInspectionServerId: Int?
/// Set on device the moment an inspection fulfilling this schedule is
/// submitted, so the SCHEDULED lists hide the row immediately online or
/// offline without waiting for the round trip.
@@ -105,6 +115,7 @@ final class LocalScheduledInspection {
self.dueDateString = api.nextDueDate ?? ""
self.isOverdue = api.isOverdue
self.notes = api.notes
self.parentInspectionServerId = api.parentInspectionId
self.fulfilledLocally = false
self.updatedAt = Date()
}
@@ -120,6 +131,7 @@ final class LocalScheduledInspection {
self.dueDateString = api.nextDueDate ?? ""
self.isOverdue = api.isOverdue
self.notes = api.notes
self.parentInspectionServerId = api.parentInspectionId
// The server is authoritative. Being returned by the pull at all means
// this schedule is live again for a recurring one, on its NEXT
// occurrence so any local "just did it" flag is stale by definition.