From 73a7f254d4cf0076df20862381155f3e707b953d Mon Sep 17 00:00:00 2001 From: varun Date: Wed, 15 May 2024 07:04:53 -0400 Subject: [PATCH] changes in motor_id --- src/controllers/tanksController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 10122ac9..d3a27e31 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -1390,11 +1390,15 @@ exports.IotDevice = async (req, reply) => { console.log(tanks) // Update waterlevel in tanksSchema for each tank for (const tank of tanks) { + console.log(tank) const { tankhardwareId, tankHeight } = tank; console.log(hardwareId,tankhardwareId) // Find the corresponding tank in tanksSchema const existingTank = await Tank.findOne({ hardwareId, tankhardwareId }); - + if (!existingTank) { + console.log(`No tank found for tankhardwareId '${tankhardwareId}'. Skipping.`); + continue; // Skip to the next iteration + } console.log(existingTank,"existing tank") if (existingTank) { // Update the waterlevel using the tankHeight value