added runtime in motordata

master^2
Varun 7 months ago
parent 731a172ea9
commit 257030e603

@ -3062,6 +3062,10 @@ exports.motorAction = async (req, reply) => {
const quantityDelivered = receiverFinalWaterLevel - parseInt(motorData.receiverInitialwaterlevel, 10);
const water_pumped_till_now = parseInt(receiverTank.total_water_added_from_midnight, 10);
const totalwaterpumped = quantityDelivered + water_pumped_till_now;
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());
await Tank.findOneAndUpdate(
{ customerId, tankName: motorData.receiverTank, tankLocation: motorData.receiver_type.toLowerCase() },
@ -3074,7 +3078,8 @@ exports.motorAction = async (req, reply) => {
$set: {
stopTime: currentTime,
receiverfinalwaterlevel: receiverFinalWaterLevel.toString(),
quantity_delivered: quantityDelivered.toString()
quantity_delivered: quantityDelivered.toString(),
runtime:runtime.toString()
}
}
);

Loading…
Cancel
Save