From 7d0031c9e81453a9f3215d7f178f24ee147591f9 Mon Sep 17 00:00:00 2001 From: Kavitha S Date: Thu, 24 Oct 2024 09:41:39 +0530 Subject: [PATCH] Kavitha| fix support for array with keys --- .../Vitals/utils/VitalsUtils.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/features/DisplayControls/Vitals/utils/VitalsUtils.js b/src/features/DisplayControls/Vitals/utils/VitalsUtils.js index 1995a339..90c36f7a 100644 --- a/src/features/DisplayControls/Vitals/utils/VitalsUtils.js +++ b/src/features/DisplayControls/Vitals/utils/VitalsUtils.js @@ -40,16 +40,15 @@ export const getConceptDetails = (conceptConfig, conceptDetails, intl) => { let concepts = {}; Object.keys(conceptConfig).forEach((conceptName) => { - const conceptByLocale = intl.formatMessage({ - id: conceptConfig[conceptName], - defaultMessage: conceptConfig[conceptName], - }); let obj; - - if (Array.isArray(conceptByLocale)) { + if (Array.isArray(conceptConfig[conceptName])) { obj = conceptDetails.filter((field) => { - return conceptByLocale.some((concept) => { - return field.fullName.toLowerCase() === concept.toLowerCase(); + return conceptConfig[conceptName].some((concept) => { + let conceptByLocale = intl.formatMessage({ + id: concept, + defaultMessage: concept, + }); + return field.fullName.toLowerCase() === conceptByLocale.toLowerCase(); }); }); @@ -58,6 +57,10 @@ export const getConceptDetails = (conceptConfig, conceptDetails, intl) => { unit: matchedField.units, })); } else { + const conceptByLocale = intl.formatMessage({ + id: conceptConfig[conceptName], + defaultMessage: conceptConfig[conceptName], + }); obj = conceptDetails.find( (field) => field.fullName.toLowerCase() === conceptByLocale.toLowerCase() );