From a5e0e59e0b9f2372229e3c38c6c462229b49a6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 9 Mar 2026 20:43:52 +0800 Subject: [PATCH] Add division by zero guards in setLoopData and setIssueData Co-Authored-By: Claude Opus 4.6 --- .../Discover/Conformance/ConformanceResults.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Discover/Conformance/ConformanceResults.vue b/src/components/Discover/Conformance/ConformanceResults.vue index e85e5fd..25f0c0f 100644 --- a/src/components/Discover/Conformance/ConformanceResults.vue +++ b/src/components/Discover/Conformance/ConformanceResults.vue @@ -567,8 +567,9 @@ const setConformanceTempReportData = (newData) => { value === null ? null : getNumberLabel((value / 86400).toFixed(1)); const isNullCase = (value) => value === null ? null : getNumberLabel(value.toFixed(1)); - const setLoopData = (value) => - value.map((item) => { + const setLoopData = (value) => { + if (newData.counts.conforming === 0) return []; + return value.map((item) => { return { no: item.no, label: item.description, @@ -577,8 +578,10 @@ const setConformanceTempReportData = (newData) => { ratio: getPercentLabel(item.count / newData.counts.conforming), }; }); - const setIssueData = (value) => - value.map((item) => { + }; + const setIssueData = (value) => { + if (newData.counts.not_conforming === 0) return []; + return value.map((item) => { return { no: item.no, label: item.description, @@ -587,6 +590,7 @@ const setConformanceTempReportData = (newData) => { ratio: getPercentLabel(item.count / newData.counts.not_conforming), }; }); + }; const isNullLoops = (value) => (value === null ? null : setLoopData(value)); const isNullIsssue = (value) => (value === null ? null : setIssueData(value));