From 49b580164087ce92bb75437d75a714ca554e3c36 Mon Sep 17 00:00:00 2001 From: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:45:36 +0530 Subject: [PATCH] Boundary fix message (#1279) * Fix for boundary validation * Optional Chaning --- .../src/server/validators/campaignValidators.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/health-services/project-factory/src/server/validators/campaignValidators.ts b/health-services/project-factory/src/server/validators/campaignValidators.ts index c166daddf8..50271de76c 100644 --- a/health-services/project-factory/src/server/validators/campaignValidators.ts +++ b/health-services/project-factory/src/server/validators/campaignValidators.ts @@ -1375,15 +1375,15 @@ function validateAllDistrictTabsPresentOrNot(request: any, dataFromSheet: any, d .filter((data: any) => getLocalizedName(`${request?.body?.ResourceDetails?.hierarchyType}_${data.type.toUpperCase()}`, localizationMap).toLocaleLowerCase() == differentTabsBasedOnLevel.toLowerCase()) .map((data: any) => getLocalizedName(data?.code, localizationMap)) || []; - tabsOfDistrict.forEach((tab: any) => { - if (!districtsLocalised.includes(tab)) { + districtsLocalised?.forEach((tab: any) => { + if (!tabsOfDistrict?.includes(tab)) { MissingDistricts.push(tab); } }); } if (MissingDistricts.length > 0) { - throwError("COMMON", 400, "VALIDATION_ERROR", `Districts ${MissingDistricts.join(', ')} not present in the Target Sheet Uploaded`); + throwError("COMMON", 400, "VALIDATION_ERROR", `District${MissingDistricts?.length > 1 ? 's' : ''} ${MissingDistricts.join(', ')} not present in the Target Sheet Uploaded`); } }