Aug 4 - Update code to follow up - MT11
This commit is contained in:
@@ -146,11 +146,13 @@ def _fulfill_schedule(inspection):
|
||||
"""Roll the originating schedule forward. Caller commits.
|
||||
|
||||
Mirrors routes/inspections.py exactly, including passing `_compute_next_run`
|
||||
as `next_run_fn`. That argument is NOT optional in practice: MT's
|
||||
`InspectionSchedule.fulfill()` leaves `next_run_at` untouched when it is
|
||||
omitted, so the schedule would stay permanently due and keep firing overdue
|
||||
reminders. The deferred import mirrors the web route and avoids a module-load
|
||||
cycle between the api and routes packages.
|
||||
as `next_run_fn`. As of phase46 that argument is accepted and ignored: the
|
||||
cadence maths moved onto `InspectionSchedule.advance_due_date()`, which owns
|
||||
the recurrence columns and the end-date boundary. Before phase46 omitting it
|
||||
silently left `next_run_at` untouched and the schedule stayed permanently
|
||||
due; the call is kept as-is so this file needs no behavioural change. The
|
||||
deferred import mirrors the web route and avoids a module-load cycle between
|
||||
the api and routes packages.
|
||||
"""
|
||||
if not inspection.inspection_schedule_id:
|
||||
return
|
||||
|
||||
@@ -56,7 +56,18 @@ def _scheduled_payload(s):
|
||||
'frequency': s.frequency,
|
||||
'frequency_label': s.frequency_label,
|
||||
'mode': s.mode,
|
||||
# phase46 recurrence detail. `recurrence_label` is the display string
|
||||
# ("Weekly · Mon, Wed, Fri"); the raw fields let the iPad render its own.
|
||||
'recurrence_label': s.recurrence_label,
|
||||
'weekdays': s.weekday_list,
|
||||
'month_mode': s.month_mode,
|
||||
'day_of_month': s.day_of_month,
|
||||
'nth_week': s.nth_week,
|
||||
'nth_weekday': s.nth_weekday,
|
||||
'next_due_date': s.next_run_at.date().isoformat() if s.next_run_at else None,
|
||||
# phase47. Additive: the iPad decodes explicit CodingKeys, so a build
|
||||
# that predates this key ignores it rather than failing to decode.
|
||||
'end_date': s.end_date.isoformat() if s.end_date else None,
|
||||
'is_overdue': s.is_overdue(),
|
||||
'notes': s.notes or None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user