diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 5309ddb9..ff4b7d51 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -6247,7 +6247,7 @@ async function processIotData(hw_Id, data) { console.log(motorData,"motorData") if (motorData) { - console.log("got into if") + const receiverTank = await Tank.findOne({ customerId:motorTank.customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() }); const receiverFinalWaterLevel = parseInt(receiverTank.waterlevel, 10); const quantityDelivered = receiverFinalWaterLevel - parseInt(motorData.receiverInitialwaterlevel, 10); @@ -6260,12 +6260,12 @@ async function processIotData(hw_Id, data) { await Tank.findOneAndUpdate( - { customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() }, + { customerId:motorTank.customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() }, { $set: { total_water_added_from_midnight: totalwaterpumped } } ); await MotorData.updateOne( - { customerId, motor_id: motorId, start_instance_id: start_instance_id }, + { customerId:motorTank.customerId, motor_id: motorId, start_instance_id: start_instance_id }, { $set: { stopTime: currentTime,