From 0964eddc0ede45f6ee8f1402a8e7ce05ed69dfe9 Mon Sep 17 00:00:00 2001 From: truthwing Date: Wed, 13 Aug 2025 11:18:50 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20filter?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=ED=95=A8=EC=88=98=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0.=20jsyang=20product(titanume=20k?= =?UTF-8?q?nife=20=EC=A4=80=EB=B9=84=20=EC=99=84=EB=A3=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-layout)/stats/rswtStat/page.tsx | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx b/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx index 99a8bc4f3..21ca5112a 100644 --- a/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx +++ b/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx @@ -132,7 +132,7 @@ export default function RswtStat() { } return item; }); - + // 시도별 합계 계산 transformedRswtDetailList.forEach((item: RswtStatProps[]) => { const sidoText = item[0]?.toString(); @@ -144,18 +144,21 @@ export default function RswtStat() { sidoData[i] = '합계'; } else if (i == 3) { // 해당 시도의 데이터 개수를 계산 - const sidoDataCount = rswtDetailList.filter((data: unknown[]) => - Array.isArray(data) && data.length > 0 && String(data[0]) === sidoText - ).length; - sidoData[i] = sidoDataCount; + if (typeof sidoData[i] === "number") { + sidoData[i] = (sidoData[i] as number) + 1; + } else if ((sidoData[i] === undefined || isNaN(Number(sidoData[i])))) { + sidoData[i] = 1; + } } else if (i == 4) { sidoData[i] = ''; } else if (i == 6) { // 법정 대상 건축물 개수 (인덱스 6이 'Y'인 경우) - const bumCnt = rswtDetailList.filter((data: unknown[]) => - Array.isArray(data) && data.length > 6 && String(data[0]) === sidoText - ).filter((data: unknown[]) => String(data[6]) === '대상').length; - sidoData[i] = bumCnt; + + if (item[i]?.toString() == '대상'&&typeof sidoData[i] === "number") { + sidoData[i] = (sidoData[i] as number) + 1; + } else if (item[i]?.toString() == '대상'&&(sidoData[i] === undefined || isNaN(Number(sidoData[i])))) { + sidoData[i] = 1; + } } else if (i == 9) { const value = Number(item[9]) || 0; sidoData[i] = (Number(sidoData[i]) + value) as string | number; @@ -256,14 +259,14 @@ export default function RswtStat() {