From 3c9a2e491257ccfaaf02e524cfc1963a5c8c52d2 Mon Sep 17 00:00:00 2001 From: Varun Date: Wed, 26 Mar 2025 13:31:02 +0530 Subject: [PATCH] changes --- src/controllers/tanksController.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 574b5569..c24a2842 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,