Jul 27 - Update code for scheduled tasks 3
This commit is contained in:
@@ -1,44 +1,42 @@
|
||||
JQC iOS — scheduled inspection fulfilment fix
|
||||
=============================================
|
||||
Repo: jqc_ios_app Branch target: main
|
||||
All paths are relative to the repo root (the folder containing JanitorialQC.xcodeproj).
|
||||
JQC iOS — recurring schedules keep showing the old due date
|
||||
===========================================================
|
||||
Repo: jqc_ios_app iOS ONLY — no server change, no migration.
|
||||
|
||||
DROP-IN (overwrite):
|
||||
OVERWRITE (paths relative to the folder containing JanitorialQC.xcodeproj):
|
||||
JanitorialQC/Models/LocalScheduledInspection.swift
|
||||
JanitorialQC/Views/Dashboard/ExecuteInspectionView.swift
|
||||
JanitorialQC/Views/Dashboard/ScheduledInspectionsView.swift
|
||||
JanitorialQC/Views/Dashboard/MyInspectionsView.swift
|
||||
JanitorialQC/Views/Dashboard/DashboardView.swift
|
||||
JanitorialQC/CLAUDE.md
|
||||
|
||||
NO new files. NO files removed. NO Xcode project edits
|
||||
(the target uses PBXFileSystemSynchronizedRootGroup — new/changed
|
||||
files under JanitorialQC/ are picked up automatically).
|
||||
No new files, none removed, no .xcodeproj edit.
|
||||
|
||||
NO server changes. NO SwiftData schema change, so no migration
|
||||
and no need to delete the app from the iPad.
|
||||
SwiftData: `fulfilledLocally: Bool = false` is a new stored property, but it is
|
||||
non-optional WITH an inline default -> lightweight migration. Existing rows read
|
||||
as false. NO need to delete the app from the iPad.
|
||||
|
||||
BUILD
|
||||
1. git pull / copy files in
|
||||
2. Xcode → Product → Clean Build Folder (Shift-Cmd-K)
|
||||
3. Build & run on the iPad
|
||||
Product > Clean Build Folder (Shift-Cmd-K), then run.
|
||||
|
||||
VERIFY
|
||||
A. Scheduled row path
|
||||
Dashboard → SCHEDULED → tap row → Start → complete → Submit
|
||||
→ SCHEDULED card clears immediately
|
||||
→ web: Inspections → Scheduled → one-time schedule shows "Inactive"
|
||||
B. "+" path (this is the case that was broken)
|
||||
Dashboard/My Inspections → "+" → pick the SAME facility + template
|
||||
as a schedule due today or earlier → complete → Submit
|
||||
→ same result as A
|
||||
C. Offline
|
||||
Airplane mode → run A → SCHEDULED card clears at once
|
||||
→ re-enable network → schedule goes Inactive on the web
|
||||
D. Regression
|
||||
Re-inspection (History → Re-inspect) must NOT deactivate any schedule
|
||||
Ad-hoc inspection for a facility whose schedule is due NEXT month
|
||||
must NOT deactivate it
|
||||
1. DAILY schedule due today. Complete + submit on the iPad.
|
||||
- SCHEDULED card clears immediately
|
||||
- within one sync cycle (<=60s) the row REAPPEARS showing TOMORROW
|
||||
Cross-check the server agrees:
|
||||
SELECT id, frequency, next_due_date, last_completed_at
|
||||
FROM scheduled_inspections WHERE id = <id>;
|
||||
2. WEEKLY Mon/Wed/Fri: complete on Monday -> row returns showing Wednesday.
|
||||
3. MONTHLY day-of-month: complete -> row returns showing next month.
|
||||
4. ONE-TIME: complete -> row clears and STAYS gone (server deactivates it).
|
||||
This is the case that always worked and must not regress.
|
||||
5. Offline: airplane mode, complete a daily schedule
|
||||
-> card clears at once, row stays hidden while offline
|
||||
-> re-enable network -> row returns with tomorrow's date
|
||||
6. Failed submit: if the inspection never syncs, the row comes back with its
|
||||
ORIGINAL date (still genuinely due) rather than staying hidden.
|
||||
|
||||
SERVER-SIDE CHECK
|
||||
sudo journalctl -u janitorial_qc --since "10 min ago" | grep "API INSPECTIONS"
|
||||
expect: API INSPECTIONS | schedule fulfilled | schedule=N | inspection=M | next=deactivated
|
||||
IF STEP 1 STILL FAILS
|
||||
Check which side is wrong before changing the app again:
|
||||
- server shows tomorrow, iPad shows today -> client, reopen this fix
|
||||
- server still shows today -> fulfill() never ran; check
|
||||
sudo journalctl -u janitorial_qc | grep "schedule fulfilled"
|
||||
|
||||
Reference in New Issue
Block a user