@@ -66,6 +66,10 @@ export async function POST(req: NextRequest, ctx: { params: Promise<{ id: string
|
||||
},
|
||||
});
|
||||
}
|
||||
// unitsCompleted is cumulative across pause/resume cycles; on close we
|
||||
// add this session's batch so the total reflects everything the step
|
||||
// actually produced.
|
||||
const units = body.unitsProcessed ?? 0;
|
||||
await tx.operation.update({
|
||||
where: { id },
|
||||
data: {
|
||||
@@ -73,6 +77,7 @@ export async function POST(req: NextRequest, ctx: { params: Promise<{ id: string
|
||||
completedAt: now,
|
||||
claimedByUserId: null,
|
||||
claimedAt: null,
|
||||
...(units > 0 ? { unitsCompleted: { increment: units } } : {}),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user