diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 1aae06e6..9c32ac08 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -10,9 +10,6 @@ const tanksController = require("./tanksController") - - - exports.addTanks = async (req, reply) => { try { @@ -258,7 +255,7 @@ exports.motorAction = async (req, reply) => { const customerId = req.params.customerId; const action = req.body.action const receiver_tank = req.body.to - const receiver_tank_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:req.body.to_type}); + const receiver_tank_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:(req.body.to_type).toLowerCase()}); const receiver_capacity = receiver_tank_info.capacity const desired_water_percentage = parseInt((req.body.percentage).replace(/,/g, ''), 10) @@ -267,8 +264,8 @@ exports.motorAction = async (req, reply) => { // start_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'}) supplier_tank = req.body.from - supplier_tank_type = req.body.from_type - receiver_type = req.body.to_type + supplier_tank_type = (req.body.from_type).toLowerCase() + receiver_type = (req.body.to_type).toLowerCase() console.log(supplier_tank) @@ -438,7 +435,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).toLowerCase()}, { $set: { motor_status: "0" } }); // reply.send({ status_code: 200, "stop time": stop_time}); } else {