Skip to content

Commit

Permalink
fix: remove timeLine datavalue from response action form
Browse files Browse the repository at this point in the history
  • Loading branch information
deeonwuli committed Nov 8, 2024
1 parent 9d2a7bb commit 69cd93b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/data/repositories/IncidentActionD2Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export type IncidentResponseActionDataValues = {
subPillar: Maybe<string>;
searchAssignRO: Maybe<string>;
dueDate: Maybe<string>;
timeLine: Maybe<string>;
status: Maybe<Status>;
verification: Maybe<Verification>;
};
Expand Down
31 changes: 17 additions & 14 deletions src/data/repositories/utils/IncidentActionMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -91,7 +90,6 @@ export function mapDataElementsToIncidentResponseActions(
subPillar,
searchAssignRO,
dueDate,
timeLine,
status,
verification,
};
Expand Down Expand Up @@ -173,19 +171,24 @@ export function mapIncidentResponseActionToDataElements(
const dataElementValues: Record<ResponseActionCodes, string> =
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,
Expand Down

0 comments on commit 69cd93b

Please sign in to comment.