From 980f9b3cca141791677f068269ee43bfc64f1e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Storl=C3=B8kken=20Melseth?= Date: Thu, 12 Oct 2023 13:17:46 +0200 Subject: [PATCH] fix: filter data elements and tracked entity attributes --- .../programs/quickStoreOperations/storePrograms.js | 3 ++- .../quickStoreOperations/storeTrackedEntityTypes.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js index b06e33bcf1..c87be25b0d 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/programs/quickStoreOperations/storePrograms.js @@ -31,7 +31,7 @@ const convert = (() => { const getProgramStageDataElements = programStageDataElements => (programStageDataElements || []) - .filter(programStageDataElement => programStageDataElement.dataElement) + .filter(programStageDataElement => programStageDataElement.dataElement?.id) .map((programStageDataElement) => { programStageDataElement.dataElement.translations = // $FlowFixMe[incompatible-type] automated comment @@ -58,6 +58,7 @@ const convert = (() => { const getProgramTrackedEntityAttributes = programAttributes => (programAttributes || []) + .filter(({ trackedEntityAttribute }) => trackedEntityAttribute?.id) .map(pa => getProgramTrackedEntityAttribute(pa)); return (response: apiProgramsResponse) => { diff --git a/src/core_modules/capture-core/metaDataStoreLoaders/trackedEntityTypes/quickStoreOperations/storeTrackedEntityTypes.js b/src/core_modules/capture-core/metaDataStoreLoaders/trackedEntityTypes/quickStoreOperations/storeTrackedEntityTypes.js index 70626f4c65..8dc6967f67 100644 --- a/src/core_modules/capture-core/metaDataStoreLoaders/trackedEntityTypes/quickStoreOperations/storeTrackedEntityTypes.js +++ b/src/core_modules/capture-core/metaDataStoreLoaders/trackedEntityTypes/quickStoreOperations/storeTrackedEntityTypes.js @@ -15,6 +15,7 @@ const convert = (() => { const getTrackedEntityTypeAttributes = trackedEntityTypeAttributes => (trackedEntityTypeAttributes || []) + .filter(({ trackedEntityAttribute }) => trackedEntityAttribute?.id) .map(trackedEntityTypeAttribute => getTrackedEntityTypeAttribute(trackedEntityTypeAttribute)); return response =>