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() {