From 80758aff310032413bba419bafc8d4af70f44b77 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Thu, 5 Jun 2025 10:27:32 +0530 Subject: [PATCH] resolved issues are stay in particular category --- src/controllers/installationController.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index c01bd092..1a9f1d8d 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -7435,7 +7435,7 @@ exports.particularCategory = async (req, reply) => { if (!support) { return reply.code(404).send({ message: "Support record not found" }); } - console.log("support",support) + // Choose the appropriate array based on category let issues = []; if (category === "Resolved") { @@ -7443,7 +7443,7 @@ exports.particularCategory = async (req, reply) => { } else { issues = (support.categorizedIssues || []).filter(issue => issue.category === category); } - console.log("issues",issues) + if (issues.length === 0) { return reply.code(404).send({ message: `No issues found for category: ${category}` }); } @@ -7489,7 +7489,9 @@ exports.particularCategory = async (req, reply) => { const disconnectedIssues = []; - for (const master of allRelatedSensors.filter(i => i.type === "master")) { + const allMasters = allRelatedSensors.filter(i => i.type === "master"); + + for (const master of allMasters) { const slaves = await Insensors.find({ connected_to: master.hardwareId, customerId @@ -7548,7 +7550,10 @@ exports.particularCategory = async (req, reply) => { team_member_support_gsm_last_check_time: master.team_member_support_gsm_last_check_time || null, connected_slave_count: slaveDetails.length, connected_slaves: slaveDetails, - comments: masterComments + comments: masterComments, + isDisconnected: + master.connected_status === "disconnected" || + slaveDetails.some(slave => slave.connected_status === "disconnected") }); } @@ -7570,6 +7575,7 @@ exports.particularCategory = async (req, reply) => { + // exports.assignCategorizeIssue = async (request, reply) => { // const { supportId } = request.params; // const { support_teamMemberId, startDate, endDate, category, masterHardwareId } = request.body;