From 205c892738fb81527e7e39d4ff1791bf1f1a1ea9 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Thu, 17 Apr 2025 12:33:20 +0530 Subject: [PATCH] changes --- src/controllers/installationController.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index 1df1c564..67e829b5 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -1034,8 +1034,6 @@ exports.mastrerList = async (req, reply) => { // } // } -//const moment = require('moment'); // For time calculations - exports.getMasterSlaveSummary = async (req, reply) => { try { @@ -1660,6 +1658,7 @@ exports.getMasterSlaveSummary = async (req, reply) => { // }; + exports.getIotDataByCustomer = async (req, reply) => { try { const { customerId } = req.params; @@ -1701,7 +1700,7 @@ exports.getIotDataByCustomer = async (req, reply) => { const connectedSlaves = sensors.filter(sensor => sensor.connected_to?.trim() === hardwareId); // Enrich tanks - const tanks = connectedSlaves.map(slave => { + let tanks = connectedSlaves.map(slave => { const slaveId = slave.hardwareId?.trim(); const matchedTank = latestRecord.tanks.find(tank => tank.tankhardwareId === slaveId); @@ -1723,6 +1722,9 @@ exports.getIotDataByCustomer = async (req, reply) => { }; }); + // ✅ Remove the first tank + tanks = tanks.slice(1); + return { hardwareId, message,