From 11e76a6d82c6732a76da669cd91399dee53c1670 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Wed, 26 Mar 2025 18:15:44 +0530 Subject: [PATCH] chnages --- src/controllers/tanksController.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index dd8fb7af..b1911fe7 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -3133,10 +3133,22 @@ exports.motorAction = async (req, reply) => { try { - + const motorData = await MotorData.findOne({ + customerId, + motor_id: motorId, + start_instance_id: dynamicInstanceId + }); + + let totalWaterPumped = 0; // Default value in case data is missing + if (motorData && motorData.quantity_delivered) { + totalWaterPumped = motorData.quantity_delivered; + } + + console.log("quantity_delivered:", totalWaterPumped); + - const totalWaterPumped = await motorData.quantity_delivered - console.log("quantity_delivered",totalWaterPumped) + //const totalWaterPumped = await motorData.quantity_delivered + // console.log("quantity_delivered",totalWaterPumped) eventEmitter.emit("motorStop", customerId, fcmToken, tankName, blockName, stopTime, "Mobile APP", totalWaterPumped, typeOfWater, motorId, loggedInUser.phone,);