diff --git a/src/data/repositories/IncidentActionD2Repository.ts b/src/data/repositories/IncidentActionD2Repository.ts index 92424d7..c15469f 100644 --- a/src/data/repositories/IncidentActionD2Repository.ts +++ b/src/data/repositories/IncidentActionD2Repository.ts @@ -67,7 +67,6 @@ export type IncidentResponseActionDataValues = { subPillar: Maybe; searchAssignRO: Maybe; dueDate: Maybe; - timeLine: Maybe; status: Maybe; verification: Maybe; }; diff --git a/src/data/repositories/utils/IncidentActionMapper.ts b/src/data/repositories/utils/IncidentActionMapper.ts index cc01fb9..43d8e88 100644 --- a/src/data/repositories/utils/IncidentActionMapper.ts +++ b/src/data/repositories/utils/IncidentActionMapper.ts @@ -77,7 +77,6 @@ export function mapDataElementsToIncidentResponseActions( const subPillar = getValueById(dataValues, incidentResponseActionsIds.subPillar); const searchAssignRO = getValueById(dataValues, incidentResponseActionsIds.searchAssignRO); const dueDate = getValueById(dataValues, incidentResponseActionsIds.dueDate); - const timeLine = getValueById(dataValues, incidentResponseActionsIds.timeLine); const status = getValueById(dataValues, incidentResponseActionsIds.status) as Status; const verification = getValueById( dataValues, @@ -91,7 +90,6 @@ export function mapDataElementsToIncidentResponseActions( subPillar, searchAssignRO, dueDate, - timeLine, status, verification, }; @@ -173,19 +171,24 @@ export function mapIncidentResponseActionToDataElements( const dataElementValues: Record = getValueFromIncidentResponseAction(incidentResponseAction); - const dataValues: DataValue[] = programStageDataElementsMetadata.map(programStage => { - if (!isStringInIncidentResponseActionCodes(programStage.dataElement.code)) { - throw new Error( - `DataElement code ${programStage.dataElement.code} not found in Incident Action Plan Codes` + const dataValues: DataValue[] = programStageDataElementsMetadata + .filter( + programStageDataElement => + programStageDataElement.dataElement.id !== incidentResponseActionsIds.timeLine + ) + .map(programStage => { + if (!isStringInIncidentResponseActionCodes(programStage.dataElement.code)) { + throw new Error( + `DataElement code ${programStage.dataElement.code} not found in Incident Action Plan Codes` + ); + } + const typedCode: IncidentResponseActionKeyCode = programStage.dataElement.code; + + return getPopulatedDataElement( + programStage.dataElement.id, + dataElementValues[typedCode] ); - } - const typedCode: IncidentResponseActionKeyCode = programStage.dataElement.code; - - return getPopulatedDataElement( - programStage.dataElement.id, - dataElementValues[typedCode] - ); - }); + }); return getIncidentActionTrackerEvent( programStageId,