master^2
Varun 7 months ago
parent 183961299a
commit e48f592e95

@ -2973,6 +2973,7 @@ exports.motorAction = async (req, reply) => {
motorIntervals[motorId] = setInterval(async () => { motorIntervals[motorId] = setInterval(async () => {
console.log(motorId,"interval created")
const supplierTank = await Tank.findOne({ customerId, tankName: req.body.from, tankLocation: req.body.from_type.toLowerCase() }); const supplierTank = await Tank.findOne({ customerId, tankName: req.body.from, tankLocation: req.body.from_type.toLowerCase() });
const currentWaterLevel = parseInt(supplierTank.waterlevel, 10); const currentWaterLevel = parseInt(supplierTank.waterlevel, 10);
const currentWaterPercentage = (currentWaterLevel / parseInt(supplierTank.capacity.replace(/,/g, ''), 10)) * 100; const currentWaterPercentage = (currentWaterLevel / parseInt(supplierTank.capacity.replace(/,/g, ''), 10)) * 100;
@ -2995,15 +2996,15 @@ exports.motorAction = async (req, reply) => {
} else { } else {
console.log("🚀 Sending threshold time notification..."); console.log("🚀 Sending threshold time notification...");
// eventEmitter.emit( eventEmitter.emit(
// "sendThresholdTimeNotification", "sendThresholdTimeNotification",
// customerId, customerId,
// fcmToken, fcmToken,
// manual_threshold_time, manual_threshold_time,
// motorId, motorId,
// tankName, tankName,
// blockName blockName
// ); );
} }
// eventEmitter.emit( // eventEmitter.emit(
// "sendThresholdTimeNotification", // "sendThresholdTimeNotification",

Loading…
Cancel
Save