From aa263d8227743b4ce25a0653092210decdb2c692 Mon Sep 17 00:00:00 2001 From: nitish-egov <137176807+nitish-egov@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:41:07 +0530 Subject: [PATCH] limited the number of columns of target for upto only 18 in number (#1190) * updated readmeconfig for sheet * added cache for generating target template when only delivery conditions change * added logic for having only 18 target columns if exceed i will create one column with header OTHER_TARGETS --- utilities/project-factory/src/server/utils/targetUtils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utilities/project-factory/src/server/utils/targetUtils.ts b/utilities/project-factory/src/server/utils/targetUtils.ts index 160c7a0cf6b..06f9b5f079c 100644 --- a/utilities/project-factory/src/server/utils/targetUtils.ts +++ b/utilities/project-factory/src/server/utils/targetUtils.ts @@ -65,13 +65,15 @@ function modifyDeliveryConditions(dataa: any[]): any { function generateTargetColumnsBasedOnDeliveryConditions(uniqueDeliveryConditions: any, localizationMap?: any) { const targetColumnsBasedOnDeliveryConditions: string[] = []; - - uniqueDeliveryConditions.forEach((str: any) => { + uniqueDeliveryConditions.forEach((str: any, index: number) => { const uniqueDeliveryConditionsObject = JSON.parse(str); // Parse JSON string into object const targetColumnString = createTargetString(uniqueDeliveryConditionsObject, localizationMap); targetColumnsBasedOnDeliveryConditions.push(targetColumnString); }); - + if (targetColumnsBasedOnDeliveryConditions.length > 18) { + targetColumnsBasedOnDeliveryConditions.splice(18); + targetColumnsBasedOnDeliveryConditions.push(getLocalizedName("OTHER_TARGETS", localizationMap)); + } return targetColumnsBasedOnDeliveryConditions; }