avoid unnecessary query
parent
1e50035474
commit
b687e15126
|
|
@ -115,7 +115,10 @@ export async function getWorkOrders(filters, options, connectedDatabase) {
|
||||||
workOrder.workOrderLotOccupancies = lotOccupancies.lotOccupancies;
|
workOrder.workOrderLotOccupancies = lotOccupancies.lotOccupancies;
|
||||||
}
|
}
|
||||||
if (options.includeMilestones ?? false) {
|
if (options.includeMilestones ?? false) {
|
||||||
workOrder.workOrderMilestones = await getWorkOrderMilestones({
|
workOrder.workOrderMilestones =
|
||||||
|
workOrder.workOrderMilestoneCount === 0
|
||||||
|
? []
|
||||||
|
: await getWorkOrderMilestones({
|
||||||
workOrderId: workOrder.workOrderId
|
workOrderId: workOrder.workOrderId
|
||||||
}, {
|
}, {
|
||||||
orderBy: 'date'
|
orderBy: 'date'
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,10 @@ export async function getWorkOrders(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.includeMilestones ?? false) {
|
if (options.includeMilestones ?? false) {
|
||||||
workOrder.workOrderMilestones = await getWorkOrderMilestones(
|
workOrder.workOrderMilestones =
|
||||||
|
workOrder.workOrderMilestoneCount === 0
|
||||||
|
? []
|
||||||
|
: await getWorkOrderMilestones(
|
||||||
{
|
{
|
||||||
workOrderId: workOrder.workOrderId
|
workOrderId: workOrder.workOrderId
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue