Bhaskar 7 months ago
commit b8e5ece0b2

@ -3059,7 +3059,7 @@ exports.motorAction = async (req, reply) => {
console.log(motorData,"motorData")
if (motorData) {
console.log("got into if")
const receiverTank = await Tank.findOne({ customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() });
const receiverFinalWaterLevel = parseInt(receiverTank.waterlevel, 10);
console.log(receiverFinalWaterLevel,"receiverFinalWaterLevel")
@ -3242,8 +3242,11 @@ async function stopMotor(motorId, customerId, start_instance_id) {
const motorData = await MotorData.findOne({ customerId, motor_id: motorId, start_instance_id });
if (motorData) {
const startTime = moment(motorData.startTime, 'DD-MMM-YYYY - HH:mm');
const runtime = moment.duration(moment(currentTime, 'DD-MMM-YYYY - HH:mm').diff(startTime)).asSeconds();
const start = moment(motorData.startTime, 'DD-MMM-YYYY - HH:mm');
const stop = moment(currentTime, 'DD-MMM-YYYY - HH:mm');
const duration = moment.duration(stop.diff(start));
const runtime = Math.floor(duration.asMinutes()); // runtime in minutes
const receiverTank = await Tank.findOne({ customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() });
const receiverFinalWaterLevel = parseInt(receiverTank.waterlevel.replace(/,/g, ''), 10);

Loading…
Cancel
Save