Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: duration calculation on kanban schedule

Brad Barbina7c7ade16c51
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/Kanban.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/Kanban.tsx
index 8469f8ed51..cba6912220 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/Kanban.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/Kanban.tsx
@@ -248,8 +248,6 @@ const Kanban = ({
? "In Progress"
: activeItem.status,
progress: progressByItemId[activeItem.id]?.progress ?? 0,
- duration:
- progressByItemId[activeItem.id]?.totalDuration ?? 0,
}}
isOverlay
{...displaySettings}
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
index 97cbd22da3..88c84d105c 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ColumnCard.tsx
@@ -46,7 +46,7 @@ export function ColumnCard({
const totalDuration = items.reduce((acc, item) => {
const progress = progressByItemId[item.id]?.progress ?? 0;
- const duration = progressByItemId[item.id]?.totalDuration ?? 0;
+ const duration = item.duration ?? 0;
const effectiveDuration = Math.max(duration - progress, 0);
return acc + effectiveDuration;
}, 0);
@@ -139,7 +139,6 @@ export function ColumnCard({
? "In Progress"
: item.status,
progress: progressByItemId[item.id]?.progress ?? 0,
- duration: progressByItemId[item.id]?.totalDuration ?? 0,
}}
{...displaySettings}
/>
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
index e64c279e62..a0db5e96ed 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
@@ -129,13 +129,6 @@ export function ItemCard({
? new Date(item.dueDate) < new Date()
: false;
- console.log({
- value:
- item.progress && item.duration
- ? (item.progress / item.duration) * 100
- : 0,
- });
-
return (
<Card
ref={setNodeRef}
diff --git a/apps/carbon/app/routes/x+/schedule+/index.tsx b/apps/carbon/app/routes/x+/schedule+/index.tsx
index 00aa27e0ae..62562bbaf6 100644
--- a/apps/carbon/app/routes/x+/schedule+/index.tsx
+++ b/apps/carbon/app/routes/x+/schedule+/index.tsx
@@ -199,7 +199,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
subtitle: op.itemReadableId,
description: op.description,
dueDate: op.jobDueDate,
- duration: 0, // set in the client
+ duration:
+ operation.setupDuration +
+ operation.laborDuration +
+ operation.machineDuration, // set in the client
progress: 0, // set in the client
deadlineType: op.jobDeadlineType,
customerId: op.jobCustomerId,