From ef291f20e77c71185934fd1c9517876e8c1e25de Mon Sep 17 00:00:00 2001 From: varun Date: Tue, 14 Mar 2023 01:43:46 -0400 Subject: [PATCH] changes in tanks and start and stop regarding bore to sump --- src/controllers/tanksController.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 79d1ac66..1aae06e6 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -273,7 +273,7 @@ exports.motorAction = async (req, reply) => { if(supplier_tank_type==="sump" && receiver_type === "overhead"){ - await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: 1 } }); + await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "1" } }); const supplier_tank_info1 = await Tank.findOne({ customerId ,tankName:supplier_tank,tankLocation:supplier_tank_type}); console.log(supplier_tank_info1) @@ -294,7 +294,7 @@ exports.motorAction = async (req, reply) => { // Check if updating should stop if ((newSupplierWaterLevel/supplier_capacity)*100 <= 5 || (newWaterLevel/receiver_capacity)*100 >= 95 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0") { clearInterval(intervalId) - await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: 0 } }); + await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "0" } }); console.log("end"); } else { @@ -363,7 +363,7 @@ exports.motorAction = async (req, reply) => { if(supplier_tank_type==="bore" && receiver_type === "sump"){ const receiver_capacity = parseInt(receiver_tank_info.capacity.replace(/,/g, ''), 10) console.log(receiver_capacity,"0") - await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: 1 } }); + await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "1" } }); let receiver_waterlevel = parseInt(receiver_tank_info.waterlevel.replace(/,/g, ''), 10) console.log(receiver_waterlevel,"1") @@ -376,7 +376,7 @@ exports.motorAction = async (req, reply) => { // Check if updating should stop if ((newWaterLevel/receiver_capacity)*100 >= 97 || (newWaterLevel/receiver_capacity)*100 >= desired_water_percentage || rcvr_info.motor_status === "0" ) { - await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: 0 } }); + await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:receiver_type}, { $set: { motor_status: "0" } }); clearInterval(intervalId) console.log("end"); } else { @@ -438,7 +438,7 @@ exports.motorAction = async (req, reply) => { // stop_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'}) // console.log(stop_time) // clearInterval(intervalId); - await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:req.body.to_type}, { $set: { motor_status: 0 } }); + await Tank.findOneAndUpdate({customerId, tankName: receiver_tank,tankLocation:req.body.to_type}, { $set: { motor_status: "0" } }); // reply.send({ status_code: 200, "stop time": stop_time}); } else {