Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SARodrigues committed Jan 25, 2024
2 parents f32271d + 3894621 commit 4d95ed1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export const getCategories = createSelector(
const availableCategoryKeys = Object.keys(categories).filter(categoryId =>
uniqAvailableCategoryIds.includes(+categoryId)
);

return availableCategoryKeys.map(category => ({
label: categories[category].name,
value: categories[category].slug,
Expand Down Expand Up @@ -249,6 +250,8 @@ export const getIndicatorsParsed = createSelector(
const parsedIndicators = sortBy(
uniqBy(
indicators.map(i => {
if (!(i.locations && Object.values(i.locations)[0])) return null;

// Add indicator groups from the sector relationship - Sectoral categories
let parentSectorName;
if (i.locations && Object.values(i.locations)[0]) {
Expand All @@ -263,6 +266,7 @@ export const getIndicatorsParsed = createSelector(
parentIndicatorNames.push(parentSectorName);
}
}

return {
label: i.name,
value: i.slug,
Expand All @@ -271,13 +275,14 @@ export const getIndicatorsParsed = createSelector(
legendBuckets: i.labels,
group: parentSectorName
};
}),
}).filter((i) => i !== null),
'value'
),
'label'
);

parentIndicatorNames = uniq(parentIndicatorNames);

return parsedIndicators.map(i =>
parentIndicatorNames.includes(i.label)
? { ...i, groupParent: i.label }
Expand Down Expand Up @@ -305,7 +310,7 @@ export const getSelectedCategory = createSelector(

export const getCategoryIndicators = createSelector(
[getIndicatorsParsed, getSelectedCategory],
categoryIndicatorsFunction
(indicatorsParsed, selectedCategory) => categoryIndicatorsFunction(indicatorsParsed, selectedCategory)
);

export const getSelectedIndicator = createSelector(
Expand Down

0 comments on commit 4d95ed1

Please sign in to comment.