Skip to content

Commit

Permalink
Fix for null codesTargetMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov committed Dec 26, 2024
1 parent 879e645 commit 407c61c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions health-services/project-factory/src/server/api/genericApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ const getTargetSheetDataAfterCode = async (

// Process each row of the sheet data
const processedData = jsonData.map((row: any, rowIndex: any) => {
// Skip the header row (rowIndex 0)
if (rowIndex <= 0) return null;

// Initialize an object to hold row-specific data
let rowData: any = { [codeColumnName]: row[codeColumnName] };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ async function createProject(
}

const enrichTargetForProject = (project: any, codesTargetMapping: any, boundaryCode: any) => {
if ( codesTargetMapping && Object.keys(codesTargetMapping?.[boundaryCode]).length > 0) {
if (codesTargetMapping?.[boundaryCode] && Object.keys(codesTargetMapping[boundaryCode]).length > 0) {
let targets = [];
for (const key in codesTargetMapping?.[boundaryCode]) {
let targetNo = parseInt(codesTargetMapping?.[boundaryCode][key]);
Expand All @@ -2373,6 +2373,9 @@ const enrichTargetForProject = (project: any, codesTargetMapping: any, boundaryC
project.targets = targets;
}
}
else{
logger.info(`No targets found for boundary code ${boundaryCode}`);
}
}

async function processAfterPersist(request: any, actionInUrl: any) {
Expand Down

0 comments on commit 407c61c

Please sign in to comment.