fix(work-orders): dedupe completedDate and gate Completed on technician (SH-188)

Refresh onto current dev and resolve exact-head review blockers:

- Remove duplicate WorkOrderBoardRowApi.completedDate after merge with dev

- Add SH-114 Technician closability gate alongside company/vendor check

- Update wo-closability regressions for missing technician
This commit is contained in:
Arthur Bassi 2026-08-13 15:21:16 -03:00
parent 43cee3698f
commit 1835a5939a
3 changed files with 7 additions and 5 deletions

View file

@ -162,8 +162,6 @@ export interface WorkOrderBoardRowApi {
serviceNotes?: string | null;
extraServices?: string[] | null;
docStatus?: number | null;
/** Work completed date from board/detail contract. */
completedDate?: string | null;
primaryDispatchId?: number | null;
rowVersion?: string | null;
dispatchRowVersion?: string | null;

View file

@ -10,7 +10,7 @@ export type WoClosabilityInput = {
dispatcherName: string;
/** Vendor/company assignment on the board row. */
company: string;
/** Technician name is informational and does not satisfy the vendor requirement. */
/** Technician assigned to the work order. */
tech: string;
/** Work completed date (API CompletedDate). Empty until set. */
completedDate: string;
@ -70,6 +70,9 @@ export function getClosabilityGaps(row: WoClosabilityInput): string[] {
if (!hasDispatcher(row)) {
gaps.push("Dispatcher");
}
if (!row.tech.trim()) {
gaps.push("Technician");
}
if (!row.company.trim()) {
gaps.push("Company / vendor");
}

View file

@ -60,8 +60,8 @@ describe("getClosabilityGaps", () => {
expect(getClosabilityGaps(makeInput())).toEqual([]);
});
it("accepts a company without a technician", () => {
expect(getClosabilityGaps(makeInput({ tech: "" }))).toEqual([]);
it("blocks Completed when technician is missing", () => {
expect(getClosabilityGaps(makeInput({ tech: "" }))).toEqual(["Technician"]);
});
it("does not let a technician satisfy a missing company requirement", () => {
@ -86,6 +86,7 @@ describe("getClosabilityGaps", () => {
),
).toEqual([
"Dispatcher",
"Technician",
"Company / vendor",
"Completed Date",
"WO number",