Skip to content

Commit

Permalink
Dont show xa geos on world map for MCF (#293)
Browse files Browse the repository at this point in the history
* Dont show XAA or XAB for MCF on map

* Update WorldMap.tsx

* Update WorldMap.tsx
  • Loading branch information
katybaulch authored Dec 2, 2024
1 parent 6194d4b commit 6ee77ca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/map/WorldMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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] = {
Expand Down

0 comments on commit 6ee77ca

Please sign in to comment.