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: set end time for production events where end time is null

Brad Barbined469c31077f
diff --git a/apps/mes/app/services/operations.service.ts b/apps/mes/app/services/operations.service.ts
index ea40a8df57..27f80ad61f 100644
--- a/apps/mes/app/services/operations.service.ts
+++ b/apps/mes/app/services/operations.service.ts
@@ -36,7 +36,8 @@ export async function finishJobOperation(
endTime: new Date().toISOString(),
updatedBy: args.userId,
})
- .eq("jobOperationId", args.jobOperationId);
+ .eq("jobOperationId", args.jobOperationId)
+ .is("endTime", null);
if (closeProductionEvents.error) {
return closeProductionEvents;