diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 356bbef2..ce70137a 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -373,6 +373,15 @@ exports.motorAction = async (req, reply) => { if(supplier_tank_type==="sump" && receiver_type === "sump"){ const receiver_capacity = parseInt(receiver_tank_info.capacity.replace(/,/g, ''), 10) + + const sumpTank = await Tank.findOne({ customerId, tankName: receiver_tank, tankLocation: receiver_type }); + const connection = sumpTank.connections.inputConnections.find((conn) => conn.inputConnections === supplier_tank); + + if (connection) { + connection.motor_status = "1"; + await sumpTank.save(); + } + // console.log(receiver_capacity,"0",receiver_tank_info.tankName) await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "1" } }); const supplier_tank_info = await Tank.findOne({ customerId ,tankName:supplier_tank,tankLocation:supplier_tank_type});