Aug 5 - Update code to follow up ST - MT14b
This commit is contained in:
@@ -171,6 +171,21 @@ class InspectionSchedule(db.Model):
|
||||
nullable=True, index=True,
|
||||
)
|
||||
|
||||
# ── Receipt acknowledgement (phase50) ────────────────────────────────────
|
||||
# Stamped when the assigned inspector confirms they received the request.
|
||||
# NULL = awaiting confirmation.
|
||||
#
|
||||
# Per ASSIGNMENT, not per occurrence: fulfill() and advance_due_date()
|
||||
# deliberately leave this alone as the schedule rolls forward, so an
|
||||
# inspector who confirmed "yes, this weekly round is mine" is not asked
|
||||
# again every week. The edit route resets it to NULL on reassignment to a
|
||||
# DIFFERENT inspector, who has confirmed nothing.
|
||||
#
|
||||
# The acknowledger is always `inspector` — the only person the routes let
|
||||
# confirm — so no separate acknowledged_by column is needed. Only meaningful
|
||||
# for mode='plan'; an auto schedule has no request to receive.
|
||||
acknowledged_at = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
created_by = db.Column(
|
||||
db.Integer, db.ForeignKey('users.id', ondelete='SET NULL'),
|
||||
nullable=True
|
||||
@@ -228,6 +243,11 @@ class InspectionSchedule(db.Model):
|
||||
"""True when this schedule was created to follow up an inspection."""
|
||||
return self.parent_inspection_id is not None
|
||||
|
||||
@property
|
||||
def is_acknowledged(self):
|
||||
"""True once the assigned inspector has confirmed receipt (phase50)."""
|
||||
return self.acknowledged_at is not None
|
||||
|
||||
FREQUENCY_LABELS = {
|
||||
'once': 'One-time',
|
||||
'daily': 'Daily',
|
||||
|
||||
Reference in New Issue
Block a user