mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-06 13:32:06 +00:00
fix(work-orders): keep SH-188 tooltip when mixed with other gaps
Stop copying WO lifecycle status into uplift primaryStatus on flat board rows.
This commit is contained in:
parent
32177e831b
commit
a109a68f40
4 changed files with 22 additions and 4 deletions
|
|
@ -239,7 +239,9 @@ function readUpliftSummary(item: Record<string, unknown>): WorkOrderUpliftSummar
|
||||||
hasUplift: hasUplift || pendingCount > 0,
|
hasUplift: hasUplift || pendingCount > 0,
|
||||||
pendingCount,
|
pendingCount,
|
||||||
};
|
};
|
||||||
const primaryStatus = readString(source, "primaryStatus", "PrimaryStatus", "status", "Status");
|
const primaryStatus =
|
||||||
|
readString(nested, "primaryStatus", "PrimaryStatus") ||
|
||||||
|
readString(item, "primaryStatus", "PrimaryStatus");
|
||||||
if (primaryStatus) {
|
if (primaryStatus) {
|
||||||
summary.primaryStatus = primaryStatus;
|
summary.primaryStatus = primaryStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export function getClosabilityGaps(row: WoClosabilityInput): string[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatClosabilityMissingTitle(gaps: string[]): string {
|
export function formatClosabilityMissingTitle(gaps: string[]): string {
|
||||||
if (gaps.length === 1 && gaps[0] === PENDING_UPLIFT_GAP) {
|
if (gaps.includes(PENDING_UPLIFT_GAP)) {
|
||||||
return UPLIFT_PENDING_COMPLETED_TITLE;
|
return UPLIFT_PENDING_COMPLETED_TITLE;
|
||||||
}
|
}
|
||||||
return `Missing: ${gaps.join(", ")}`;
|
return `Missing: ${gaps.join(", ")}`;
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,16 @@ describe("mapWorkOrderTableRow (board DTO)", () => {
|
||||||
expect(clear.upliftSummary).toEqual({ hasUplift: false, pendingCount: 0 });
|
expect(clear.upliftSummary).toEqual({ hasUplift: false, pendingCount: 0 });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not copy work-order status into uplift primaryStatus on flat board rows", () => {
|
||||||
|
const row = mapWorkOrderTableRow({
|
||||||
|
id: 308,
|
||||||
|
pendingUpliftCount: 1,
|
||||||
|
status: "In Progress",
|
||||||
|
Status: "In Progress",
|
||||||
|
});
|
||||||
|
expect(row.upliftSummary?.primaryStatus).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
it("leaves hasPendingUplift undefined when board count is absent", () => {
|
it("leaves hasPendingUplift undefined when board count is absent", () => {
|
||||||
const row = mapWorkOrderTableRow({ id: 307 });
|
const row = mapWorkOrderTableRow({ id: 307 });
|
||||||
expect(row.hasPendingUplift).toBeUndefined();
|
expect(row.hasPendingUplift).toBeUndefined();
|
||||||
|
|
|
||||||
|
|
@ -128,9 +128,15 @@ describe("formatClosabilityMissingTitle", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("joins multiple gaps with Missing prefix", () => {
|
it("uses design Completed title when pending uplift is among mixed gaps", () => {
|
||||||
expect(formatClosabilityMissingTitle(["Dispatcher", PENDING_UPLIFT_GAP])).toBe(
|
expect(formatClosabilityMissingTitle(["Dispatcher", PENDING_UPLIFT_GAP])).toBe(
|
||||||
`Missing: Dispatcher, ${PENDING_UPLIFT_GAP}`,
|
UPLIFT_PENDING_COMPLETED_TITLE,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("joins multiple non-uplift gaps with Missing prefix", () => {
|
||||||
|
expect(formatClosabilityMissingTitle(["Dispatcher", "Company"])).toBe(
|
||||||
|
"Missing: Dispatcher, Company",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue