Skip to content

Commit

Permalink
limited the number of columns of target for upto only 18 in number (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
nitish-egov authored Jul 31, 2024
1 parent a7ec4ef commit aa263d8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utilities/project-factory/src/server/utils/targetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit aa263d8

Please sign in to comment.