From 989cfcdf5272fb39587868b6ca7b933e115b8e70 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Tue, 18 Mar 2025 13:55:13 +0530 Subject: [PATCH] changes --- src/controllers/tanksController.js | 45 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 0e3f9f9a..39abb8b3 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -2909,6 +2909,7 @@ exports.motorAction = async (req, reply) => { ? `${req.body.manual_threshold_time} minutes` : `${req.body.manual_threshold_litres} litres`; try { + console.log("enter the start") eventEmitter.emit( "motorStart", customerId, @@ -3109,29 +3110,29 @@ exports.motorAction = async (req, reply) => { const notificationKey = `${customerId}_${motorId}_threshold`; // Check if the notification has already been sent - if (!notificationTracker.get(notificationKey)) { - console.log("Sending threshold time notification..."); + // if (!notificationTracker.get(notificationKey)) { + // console.log("Sending threshold time notification..."); - eventEmitter.emit( - "sendThresholdTimeNotification", - customerId, - fcmToken, - manual_threshold_time, - motorId, - tankName, - blockName - ); - - // Mark notification as sent - notificationTracker.set(notificationKey, true); - - // Optionally, reset the flag after some time (e.g., 24 hours) - setTimeout(() => { - notificationTracker.delete(notificationKey); - }, 24 * 60 * 60 * 1000); // Reset after 24 hours - } else { - console.log("Notification already sent, skipping..."); - } + // eventEmitter.emit( + // "sendThresholdTimeNotification", + // customerId, + // fcmToken, + // manual_threshold_time, + // motorId, + // tankName, + // blockName + // ); + + // // Mark notification as sent + // notificationTracker.set(notificationKey, true); + + // // Optionally, reset the flag after some time (e.g., 24 hours) + // setTimeout(() => { + // notificationTracker.delete(notificationKey); + // }, 24 * 60 * 60 * 1000); // Reset after 24 hours + // } else { + // console.log("Notification already sent, skipping..."); + // } const currentTime = moment().tz('Asia/Kolkata').format('DD-MMM-YYYY - HH:mm'); await Tank.updateOne(