Add division by zero guards in setLoopData and setIssueData
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user