changes in tanks and start and stop regarding bore to sump

master
varun 3 years ago
parent caf6686afb
commit bc0776b99d

@ -10,9 +10,6 @@ const tanksController = require("./tanksController")
exports.addTanks = async (req, reply) => { exports.addTanks = async (req, reply) => {
try { try {
@ -258,7 +255,7 @@ exports.motorAction = async (req, reply) => {
const customerId = req.params.customerId; const customerId = req.params.customerId;
const action = req.body.action const action = req.body.action
const receiver_tank = req.body.to 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 receiver_capacity = receiver_tank_info.capacity
const desired_water_percentage = parseInt((req.body.percentage).replace(/,/g, ''), 10) 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'}) // start_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'})
supplier_tank = req.body.from supplier_tank = req.body.from
supplier_tank_type = req.body.from_type supplier_tank_type = (req.body.from_type).toLowerCase()
receiver_type = req.body.to_type receiver_type = (req.body.to_type).toLowerCase()
console.log(supplier_tank) console.log(supplier_tank)
@ -438,7 +435,7 @@ exports.motorAction = async (req, reply) => {
// stop_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'}) // stop_time = new Date().toLocaleString('en-US', {timeZone: 'Asia/Kolkata'})
// console.log(stop_time) // console.log(stop_time)
// clearInterval(intervalId); // 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}); // reply.send({ status_code: 200, "stop time": stop_time});
} else { } else {

Loading…
Cancel
Save