Skip to content

Commit

Permalink
Kavitha| fix support for array with keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kavitha-sundararajan committed Oct 24, 2024
1 parent afda3b1 commit 7d0031c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/features/DisplayControls/Vitals/utils/VitalsUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

Expand All @@ -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()
);
Expand Down

0 comments on commit 7d0031c

Please sign in to comment.