fix(time-tracking): consume contract hours on timesheet approval (PMS-405) #307
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-405-wire-time-to-contract-balance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Wires the time-entry approval transition to
ContractsService::consume_hours, fixing the PMS-405 wiring bug wherecontract_hour_balancesnever decremented in production becauseconsume_hourshad no production callers. Onapprove_timesheet, every entry that flips from pending to approved and is billable against a contract now drawsduration_minutes / 60hours from the contract's block-hours balance for the entry's period; thependingguard keeps re-approval idempotent so hours are never double-counted, and hours pastincluded_hoursfall out as a non-zero overage that is persisted via the debited balance row and logged for the recurring-invoice follow-up. No new contract-level hours column is introduced (allotment remainscontract_items.included_hours). Adds integration tests asserting the within-allotment decrement, the overage split, and the re-approval no-op.#PMS-405