master^2
Bhaskar 6 months ago
parent aa63f6519e
commit 205c892738

@ -1034,8 +1034,6 @@ exports.mastrerList = async (req, reply) => {
// } // }
// } // }
//const moment = require('moment'); // For time calculations
exports.getMasterSlaveSummary = async (req, reply) => { exports.getMasterSlaveSummary = async (req, reply) => {
try { try {
@ -1660,6 +1658,7 @@ exports.getMasterSlaveSummary = async (req, reply) => {
// }; // };
exports.getIotDataByCustomer = async (req, reply) => { exports.getIotDataByCustomer = async (req, reply) => {
try { try {
const { customerId } = req.params; const { customerId } = req.params;
@ -1701,7 +1700,7 @@ exports.getIotDataByCustomer = async (req, reply) => {
const connectedSlaves = sensors.filter(sensor => sensor.connected_to?.trim() === hardwareId); const connectedSlaves = sensors.filter(sensor => sensor.connected_to?.trim() === hardwareId);
// Enrich tanks // Enrich tanks
const tanks = connectedSlaves.map(slave => { let tanks = connectedSlaves.map(slave => {
const slaveId = slave.hardwareId?.trim(); const slaveId = slave.hardwareId?.trim();
const matchedTank = latestRecord.tanks.find(tank => tank.tankhardwareId === slaveId); 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 { return {
hardwareId, hardwareId,
message, message,

Loading…
Cancel
Save