From ad7c52cb04a5edee389acaa2529da0b574065070 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Wed, 4 Jun 2025 17:14:08 +0530 Subject: [PATCH] changes --- src/controllers/installationController.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index 52959b87..beaf03fa 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -6954,14 +6954,22 @@ exports.moveIssueToCategory = async (req, reply) => { const issue = support.issues[index]; + // Normalize type if it's invalid + const normalizedType = + issue.type === "GSM or LoRa Disconnected" ? "GSM Disconnected" : issue.type; + if (issue.hardwareId === hardwareId) { - issue.movedToCategory = true; // ✅ Mark moved + issue.movedToCategory = true; + support.categorizedIssues.push({ - ...issue, + type: normalizedType, + hardwareId: issue.hardwareId, masterHardwareId: issue.masterHardwareId || issue.hardwareId, category, movedAt: nowTime, + movedToCategory: true, }); + support.issues.splice(index, 1); issueMoved = true; } else { @@ -6970,13 +6978,13 @@ exports.moveIssueToCategory = async (req, reply) => { const slaveName = issue.slaveNames?.[slaveIndex] || "Unknown"; support.categorizedIssues.push({ - type: issue.type, + type: normalizedType, hardwareId, masterHardwareId: issue.masterHardwareId || issue.hardwareId, slaveName, category, movedAt: nowTime, - movedToCategory: true, // ✅ Track it here too + movedToCategory: true, }); issue.hardwareIds.splice(slaveIndex, 1); @@ -7002,6 +7010,7 @@ exports.moveIssueToCategory = async (req, reply) => { } }; + exports.particularCategory = async (req, reply) => { try { const { supportId, category } = req.params;