Commit graph

5 commits

Author SHA1 Message Date
Alexandre Brandizzi
efe4f5f0b9 test: pin add-on across week-only toggles and date-less edits
Keep the add-on recalculation on the week-only toggle so a future schedule
side effect cannot leave a stale tag, and cover that a toggle and an edit
without Schedule On leave Add-On unchanged.
2026-10-01 16:22:44 -03:00
Alexandre Brandizzi
b9f9725c73 fix: recalculate add-on at reschedule time, not creation time
A reschedule moves the work order into its new week at the moment of the
reschedule, so Add-On now compares that moment with the new week's cutoff,
matching the prototype. Moves within the same week keep the current value.
Previously an older work order moved into a week already past its cutoff
stayed off because it was created before that cutoff (SH-412).
2026-10-01 16:10:19 -03:00
Alexandre Brandizzi
c02749a4ea fix: run work order edit reschedule under the mutation lock
UpdateWorkOrderAsync loaded the work order, applied the shared schedule
side effects (RescheduleCount, OriginalDate/OriginalWeek, lifecycle,
IsAddOn) and saved with no gate, transaction or row lock, so a
concurrent reschedule could interleave with the read-modify-write.

The read, the mutation, the save and the audit entry now run through
IWorkOrderDataService.ExecuteWorkOrderMutationAsync, which uses the
shared WorkOrderMutationLock: the per-work-order in-process gate, a
transaction, and an UPDLOCK on the work order row on SQL Server. A
reschedule committed by another holder of the lock is read before the
edit applies its own date and increments RescheduleCount.

Adds a regression test that holds the gate, commits a reschedule, and
asserts the edit waits and then builds on the committed schedule.
2026-10-01 00:19:37 -03:00
Alexandre Brandizzi
24436c9864 fix: apply shared schedule side effects on work order edit
Route edit-path ScheduledDate changes through WorkOrderBoardFieldMutations.ApplyScheduledDate so OriginalDate/OriginalWeek, RescheduleCount and lifecycle promotion match the board PATCH path, and audit those changes.
2026-10-01 00:10:43 -03:00
Alexandre Brandizzi
ac5550365f fix: recalculate add-on on work order reschedule 2026-09-30 23:58:20 -03:00