|
|
|
@ -2121,12 +2121,13 @@ else if (currentWaterLevel >= highWaterThreshold) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const thresholdTime = moment().add(req.body.manual_threshold_time, 'minutes').toDate();
|
|
|
|
|
console.log(thresholdTime,"at start")
|
|
|
|
|
const intervalId = setInterval(async () => {
|
|
|
|
|
const supplierTank = await Tank.findOne({ customerId, tankName: req.body.from, tankLocation: req.body.from_type.toLowerCase() });
|
|
|
|
|
const currentWaterLevel = parseInt(supplierTank.waterlevel, 10);
|
|
|
|
|
const currentWaterPercentage = (currentWaterLevel / parseInt(supplierTank.capacity.replace(/,/g, ''), 10)) * 100;
|
|
|
|
|
|
|
|
|
|
if (new Date() >= thresholdTime || currentWaterPercentage <= lowWaterThreshold) {
|
|
|
|
|
if (moment().isSameOrAfter(thresholdTime) || currentWaterPercentage <= lowWaterThreshold) {
|
|
|
|
|
console.log(thresholdTime,"thresholdtime")
|
|
|
|
|
console.log(new Date(),"new time")
|
|
|
|
|
console.log(currentWaterPercentage,"currentWaterPercentage")
|
|
|
|
|