master^2
Bhaskar 4 months ago
parent f4a4e23991
commit ad7c52cb04

@ -6954,14 +6954,22 @@ exports.moveIssueToCategory = async (req, reply) => {
const issue = support.issues[index]; 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) { if (issue.hardwareId === hardwareId) {
issue.movedToCategory = true; // ✅ Mark moved issue.movedToCategory = true;
support.categorizedIssues.push({ support.categorizedIssues.push({
...issue, type: normalizedType,
hardwareId: issue.hardwareId,
masterHardwareId: issue.masterHardwareId || issue.hardwareId, masterHardwareId: issue.masterHardwareId || issue.hardwareId,
category, category,
movedAt: nowTime, movedAt: nowTime,
movedToCategory: true,
}); });
support.issues.splice(index, 1); support.issues.splice(index, 1);
issueMoved = true; issueMoved = true;
} else { } else {
@ -6970,13 +6978,13 @@ exports.moveIssueToCategory = async (req, reply) => {
const slaveName = issue.slaveNames?.[slaveIndex] || "Unknown"; const slaveName = issue.slaveNames?.[slaveIndex] || "Unknown";
support.categorizedIssues.push({ support.categorizedIssues.push({
type: issue.type, type: normalizedType,
hardwareId, hardwareId,
masterHardwareId: issue.masterHardwareId || issue.hardwareId, masterHardwareId: issue.masterHardwareId || issue.hardwareId,
slaveName, slaveName,
category, category,
movedAt: nowTime, movedAt: nowTime,
movedToCategory: true, // ✅ Track it here too movedToCategory: true,
}); });
issue.hardwareIds.splice(slaveIndex, 1); issue.hardwareIds.splice(slaveIndex, 1);
@ -7002,6 +7010,7 @@ exports.moveIssueToCategory = async (req, reply) => {
} }
}; };
exports.particularCategory = async (req, reply) => { exports.particularCategory = async (req, reply) => {
try { try {
const { supportId, category } = req.params; const { supportId, category } = req.params;

Loading…
Cancel
Save