checking motoraction

master^2
Varun 9 months ago
parent 1e9272faab
commit 45a03f5aac

@ -3017,9 +3017,12 @@ exports.motorAction = async (req, reply) => {
delete motorIntervals[motorId]; // Remove from interval object
this.publishMotorStopStatus(motorId, "1");
console.log(start_instance_id,"start_instance_id",customerId,"customerId",motorId,"motorId")
const motorData = await MotorData.findOne({ customerId, motor_id: motorId, start_instance_id: start_instance_id });
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);
const quantityDelivered = receiverFinalWaterLevel - parseInt(motorData.receiverInitialwaterlevel, 10);

Loading…
Cancel
Save