From 6ee77cafae87a53b9d97c4b25f454449ac4d4760 Mon Sep 17 00:00:00 2001 From: Katy Baulch <46493669+katybaulch@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:06:08 +0000 Subject: [PATCH] Dont show xa geos on world map for MCF (#293) * Dont show XAA or XAB for MCF on map * Update WorldMap.tsx * Update WorldMap.tsx --- src/components/map/WorldMap.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/map/WorldMap.tsx b/src/components/map/WorldMap.tsx index 7ee6ea38..e2402ccc 100644 --- a/src/components/map/WorldMap.tsx +++ b/src/components/map/WorldMap.tsx @@ -142,8 +142,8 @@ export default function MapChart() { const maxLawsPolicies = mapDataRaw.length ? Math.max(...mapDataRaw.map((g) => (g.family_counts?.EXECUTIVE || 0) + (g.family_counts?.LEGISLATIVE || 0))) : 0; - const maxMcf = mapDataRaw.length ? Math.max(...mapDataRaw.map((g) => g.family_counts?.MCF || 0)) : 0; - // Only take UNFCCC counts for countries that are not XAA or XAB (international, no geography) + // Only take UNFCCC and MCF counts for countries that are not XAA or XAB (international, no geography) + const maxMcf = mapDataRaw.length ? Math.max(...mapDataRaw.map((g) => (["XAA", "XAB"].includes(g.iso_code) ? 0 : g.family_counts?.MCF || 0))) : 0; const maxUnfccc = mapDataRaw.length ? Math.max(...mapDataRaw.map((g) => (["XAA", "XAB"].includes(g.iso_code) ? 0 : g.family_counts?.UNFCCC || 0))) : 0; @@ -158,7 +158,9 @@ export default function MapChart() { mapDataConstructor.geographies = configCountries.reduce((acc, country) => { const geoStats = mapDataRaw.find((geo) => geo.slug === country.slug); const lawsPoliciesCount = (geoStats?.family_counts?.EXECUTIVE || 0) + (geoStats?.family_counts?.LEGISLATIVE || 0); - const unfcccCount = ["XAA", "XAB"].includes(country.value) ? 0 : geoStats?.family_counts?.UNFCCC || 0; + + // As the map has no where to display XAA or XAB data we don't need to fiddle with the count. + const unfcccCount = geoStats?.family_counts?.UNFCCC || 0; const mcfCount = geoStats?.family_counts?.MCF || 0; acc[country.value] = {