perf: limit cut plan to active orders
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 53s

This commit is contained in:
Cauê Faleiros
2026-08-28 13:14:21 -03:00
parent 4122e21dc2
commit 9d99f2387b
3 changed files with 8 additions and 3 deletions

View File

@@ -884,6 +884,10 @@ const listProductionOrders = async (filters = {}) => {
)`);
}
if (filters.activeOnly === 'true') {
where.push(`po.status IN ('open', 'cutting', 'sewing', 'review', 'in_progress')`);
}
const result = await pool.query(`
${baseProductionOrderSelect}
${where.length ? `WHERE ${where.join(' AND ')}` : ''}