Reorder job carries over _inspectorRequestedIds from source inspection
Objective
- When a job is reordered via the workorder Actions menu, the new inspection should start with a clean requested inspector state — no inspector should be pre-marked as requested on the reordered job.
- Prevent incorrect requested-inspector bonus payouts that result from the inherited flag being present on re-inspect jobs without explicit intent.
Background
- Neil Chini (Axium/Colorado) surfaced a payroll discrepancy: inspector Michael was receiving $100 in requested-inspector bonus instead of the expected $75, with an extra $25 attributed to a component re-inspection at the same address (AXI1346).
- Investigation confirmed that AXI1346 was booked as a reordered job (a primary service, not an event), and that Michael was present in
_inspectorRequestedIdson that new inspection — carried over silently from the original. - The reorder flow navigates to
/schedule?reorderFrom=<inspectionId>(WorkorderActionsDropdown.tsx).NewSchedulingForm.tsxreads that query param and pre-populates the new inspection from the source job, including_inspectorRequestedIds. - The requested flag has no meaningful relationship to the new inspection. It reflects a client or office preference on the original job. The reordered job is a distinct booking and must establish its own requested status independently.
- The downstream consumer of this field —
calcBonus.ts— correctly counts any inspection where the employee is in_inspectorRequestedIdstoward their requested-inspector bonus. The logic is sound; the data coming in is incorrect. - Clearing should be silent — no UI notification to the scheduler.
Product Decisions
Locked
- Clear on reorder —
_inspectorRequestedIdsmust not be copied from the source inspection to the reordered inspection. - Silent clear — no toast, note, or visual indicator when the field is omitted.
Scope
Frontend — Scheduling
attik/apps/frontend/src/components/scheduling/NewSchedulingForm.tsx— thereorderFrompre-population logic is where the source inspection's fields are read and applied to the new scheduling form state. The fix is to exclude_inspectorRequestedIdswhen hydrating form state from the source job.
Backend — Payroll (reference only, no change needed)
attik/apps/backend/src/util/functions/payroll/calcBonus.ts— requested bonus calculation; correct as-is.attik/apps/backend/src/util/functions/payroll/payrollContext.ts—calcBonuscalled here per-inspector.
References
- Reorder entry point:
attik/apps/frontend/src/app/tools/inspections/[id]/components/WorkorderActionsDropdown.tsx - Related: ATT-1164 — Preserve inspector request when rescheduling (distinct: reschedule should preserve the flag; reorder should clear it)
- Related: ATT-1738 — Reschedule job locks unrelated inspector
Status: Planned
Log in to comment and vote
No comments yet
Be the first to share your thoughts.