Skip to content

Commit

Permalink
Merge pull request #3468 from Vizzuality/fix/emissions-calculations
Browse files Browse the repository at this point in the history
Fixes Emissions Calculations in Natural Forest Loss widget
  • Loading branch information
edbrett committed Jun 8, 2018
2 parents 69e90fd + fe05136 commit fa9962c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import groupBy from 'lodash/groupBy';
import { format } from 'd3-format';
import { formatNumber } from 'utils/format';
import { getColorPalette } from 'utils/data';
import { biomassToCO2 } from 'utils/calculations';

// get list data
const getLoss = state => (state.data && state.data.loss) || null;
Expand Down Expand Up @@ -93,7 +94,7 @@ export const getSentence = createSelector(
startYear,
endYear,
lossPhrase,
value: `${format('.3s')(outsideEmissions)}t`,
value: `${format('.3s')(biomassToCO2(outsideEmissions))}t`,
percentage: formatNumber({ num: percentage, unit: '%' })
};

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/pages/dashboards/header/header-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const getSentence = createSelector(
const lossWithOutPlantations = format('.2s')(
data.totalLoss.area - (data.plantationsLoss.area || 0)
);
const emissionsWithoutPlantations = format('.2s')(
const emissionsWithoutPlantations = format('.3s')(
biomassToCO2(
data.totalLoss.emissions - (data.plantationsLoss.emissions || 0)
)
Expand Down

0 comments on commit fa9962c

Please sign in to comment.