|
|
|
@ -2830,9 +2830,12 @@ exports.getPendingOrdersByInstallationAndTeamMember = async (req, reply) => {
|
|
|
|
|
// Keep only master_connections with work_status === 'pending'
|
|
|
|
|
const pendingMasters = order.master_connections.filter(mc => mc.work_status === 'pending');
|
|
|
|
|
|
|
|
|
|
const pendingWorkStatuses = pendingMasters.map(mc => mc.work_status);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
...order.toObject(),
|
|
|
|
|
master_connections: pendingMasters,
|
|
|
|
|
work_status: pendingMasters.length > 0 ? pendingMasters[0].work_status : null,
|
|
|
|
|
customer: customer || null,
|
|
|
|
|
allocated_sensors: allocatedSensors,
|
|
|
|
|
};
|
|
|
|
|