From 780d1f4178c2bbddcf5bad8a81ee9c7e6b600378 Mon Sep 17 00:00:00 2001 From: Varun Date: Tue, 18 Mar 2025 17:19:08 +0530 Subject: [PATCH] changes --- src/controllers/tanksController.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 0c3e6057..05b3d607 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -2868,18 +2868,17 @@ exports.motorAction = async (req, reply) => { if (action === "start") { if (motorIntervals[motorId]) { - console.log(`🛑 Clearing interval for motorId: ${motorId}`); + console.log(`🛑 Clearing old interval for motorId: ${motorId}`); clearInterval(motorIntervals[motorId]); delete motorIntervals[motorId]; // Confirm deletion if (!motorIntervals[motorId]) { - console.log(`✅ Interval for motorId: ${motorId} successfully deleted.`); + console.log(`✅ Old interval successfully deleted.`); } else { - console.error(`❌ Failed to delete interval for motorId: ${motorId}`); + console.error(`❌ Failed to delete old interval.`); } } - const startTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm'); @@ -2894,8 +2893,8 @@ exports.motorAction = async (req, reply) => { }} ); - eventEmitter.emit("motorStart", customerId, fcmToken, tankName, blockName, startTime, "Mobile APP", manual_threshold_time, typeOfWater, motorId, loggedInUser.phone); - this.publishMotorStopStatus(motorId, motorStopStatus); + eventEmitter.emit("motorStart", customerId, fcmToken, tankName, blockName, startTime, "Mobile APP", manual_threshold_time, typeOfWater, motorId, loggedInUser.phone); + //this.publishMotorStopStatus(motorId, motorStopStatus); reply.code(200).send({ message: "Motor started successfully." }); if (req.body.threshold_type === "time") {