Aug 3 - Update scheduled task acknowledged

This commit is contained in:
2026-08-03 12:51:01 -04:00
parent 6513e6b4f6
commit 38acb6a52e
8 changed files with 182 additions and 4 deletions
+15
View File
@@ -130,6 +130,16 @@ class ScheduledInspection(db.Model):
created_at = db.Column(db.DateTime, nullable=False, default=now_eastern)
last_completed_at = db.Column(db.DateTime, nullable=True)
# ── Receipt acknowledgement (phase47) ────────────────────────────────────
# When the assigned inspector confirms they have received/seen this
# assignment. Once per assignment: NULL means "awaiting confirmation"; it is
# reset to NULL when the schedule is reassigned to a different inspector so
# the new assignee must confirm afresh. It is NOT reset when a recurring
# schedule rolls forward — the acknowledgement is of the assignment, not of
# each occurrence. The acknowledger is always `inspector` (the only person
# allowed to confirm), so no separate acknowledged_by column is needed.
acknowledged_at = db.Column(db.DateTime, nullable=True)
# Per-occurrence reminder de-dup flags (reset when a recurring one rolls forward)
advance_notified = db.Column(db.Boolean, nullable=False, default=False)
due_notified = db.Column(db.Boolean, nullable=False, default=False)
@@ -269,6 +279,11 @@ class ScheduledInspection(db.Model):
"""
return self.end_date is None or d <= self.end_date
@property
def is_acknowledged(self):
"""True once the assigned inspector has confirmed receipt (phase47)."""
return self.acknowledged_at is not None
@property
def is_expired(self):
"""True once the end date has passed.