Skip to content

Commit

Permalink
feat(forestLoss): fix percentage value for natural forest
Browse files Browse the repository at this point in the history
  • Loading branch information
wri7tno committed Dec 18, 2024
1 parent f0128ed commit 239e142
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default {
layers: [FOREST_LOSS],
},
],
dataType: 'naturalForest',
sortOrder: {
forestChange: 2,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,12 @@ export const parseSentence = createSelector(
(data, settings, locationName, sentence) => {
if (!data) return null;
const { startYear, endYear } = settings;
const plantationsLoss = sumBy(data, 'areaLoss') || 0;
const totalLoss = sumBy(data, 'totalLoss') || 0;
const outsideLoss = sumBy(data, 'outsideAreaLoss') || 0;
const outsideEmissions = sumBy(data, 'outsideCo2Loss') || 0;

const lossPhrase = 'natural forest';
const percentage =
plantationsLoss > outsideLoss
? (100 * plantationsLoss) / totalLoss
: (100 * outsideLoss) / totalLoss;
const percentage = (100 * outsideLoss) / totalLoss;
const params = {
location: locationName,
startYear,
Expand Down
2 changes: 1 addition & 1 deletion components/widgets/land-cover/natural-forest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
categories: ['land-cover', 'summary'],
types: ['global', 'country', 'geostore', 'aoi', 'wdpa', 'use'],
admins: ['global', 'adm0', 'adm1', 'adm2'],
visible: ['dashboard', 'analysis'],
visible: ['dashboard'],
datasets: [
{
dataset: POLITICAL_BOUNDARIES_DATASET,
Expand Down

0 comments on commit 239e142

Please sign in to comment.