From 7c6e6c746dd0a62f8a11812b1359ebeda8e04755 Mon Sep 17 00:00:00 2001 From: varun Date: Sat, 11 May 2024 01:18:01 -0400 Subject: [PATCH] change in iot --- src/controllers/tanksController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index eb765a1d..25965dd4 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -1405,7 +1405,10 @@ exports.IotDevice1 = async (req, reply) => { // Update waterlevel in tanksSchema for each tank for (const tank of tanks) { const { tankhardwareId, tankHeight } = tank; - + + if (tankHeight === null || tankHeight === undefined) { + continue; // Skip this iteration and move to the next tank + } // Find the corresponding tank in tanksSchema const existingTank = await Tank.findOne({ hardwareId, tankhardwareId });