|
|
@ -3242,8 +3242,11 @@ async function stopMotor(motorId, customerId, start_instance_id) {
|
|
|
|
|
|
|
|
|
|
|
|
const motorData = await MotorData.findOne({ customerId, motor_id: motorId, start_instance_id });
|
|
|
|
const motorData = await MotorData.findOne({ customerId, motor_id: motorId, start_instance_id });
|
|
|
|
if (motorData) {
|
|
|
|
if (motorData) {
|
|
|
|
const startTime = moment(motorData.startTime, 'DD-MMM-YYYY - HH:mm');
|
|
|
|
const start = moment(motorData.startTime, 'DD-MMM-YYYY - HH:mm');
|
|
|
|
const runtime = moment.duration(moment(currentTime, 'DD-MMM-YYYY - HH:mm').diff(startTime)).asSeconds();
|
|
|
|
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 receiverTank = await Tank.findOne({ customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() });
|
|
|
|
const receiverFinalWaterLevel = parseInt(receiverTank.waterlevel.replace(/,/g, ''), 10);
|
|
|
|
const receiverFinalWaterLevel = parseInt(receiverTank.waterlevel.replace(/,/g, ''), 10);
|
|
|
|