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 _inspectorRequestedIds on that new inspection — carried over silently from the original.
  • The reorder flow navigates to /schedule?reorderFrom=<inspectionId> (WorkorderActionsDropdown.tsx). NewSchedulingForm.tsx reads 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 _inspectorRequestedIds toward 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

  1. Clear on reorder — _inspectorRequestedIds must not be copied from the source inspection to the reordered inspection.
  2. Silent clear — no toast, note, or visual indicator when the field is omitted.

Scope

Frontend — Scheduling

  • attik/apps/frontend/src/components/scheduling/NewSchedulingForm.tsx — the reorderFrom pre-population logic is where the source inspection's fields are read and applied to the new scheduling form state. The fix is to exclude _inspectorRequestedIds when 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.tscalcBonus called 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

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

About 3 hours ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.