diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index ce387ba3..7764fd8a 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -263,7 +263,7 @@ exports.motorAction = async (req, reply) => { if(action === "start"){ - // 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_type = (req.body.from_type).toLowerCase() @@ -371,6 +371,7 @@ exports.motorAction = async (req, reply) => { intervalId = setInterval(async function () { // Calculate new water levels const rcvr_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:receiver_type}); + console.log(rcvr_info) console.log(rcvr_info.motor_status) const newWaterLevel = receiver_waterlevel+450; console.log(newWaterLevel,"2",receiver_tank_info.tankName) @@ -424,14 +425,15 @@ exports.motorAction = async (req, reply) => { } const motor_data = await motorData.save(); - reply.send({ status_code: 200, data: motor_data }); - return motor_data - + // reply.send({ status_code: 200, data: motor_data }); + - // reply.send({ status_code: 200, "start time": start_time}); - //console.log(start_time) + reply.send({ status_code: 200, "start time": start_time, data: motor_data}); + console.log(start_time) + return motor_data + }