Skip to content

Commit

Permalink
feat(fao-cover): removing noPrimary sentence for global location
Browse files Browse the repository at this point in the history
We always have primary forest in a global scale (at least for now)
  • Loading branch information
willian-viana committed Nov 29, 2023
1 parent 81cde8e commit 9baff8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions components/widgets/land-cover/fao-cover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export default {
sentences: {
globalInitial:
'According to the FAO, in {year}, {percent} ({amountInHectares}) of the globe was covered by forest. {primaryPercent} of that forest was classified as primary forest.',
globalNoPrimary:
'According to the FAO, in {year},{primaryPercent} ({extent}) of the world was covered by forest.',
initial:
'According to the FAO, in {year}, {percent} ({amountInHectares}) of {country} was covered by forest. {primaryPercent} of that forest was classified as primary forest.',
noPrimary:
Expand Down
7 changes: 5 additions & 2 deletions components/widgets/land-cover/fao-cover/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const parseSentence = createSelector(
(data, locationName, sentences, settings) => {
if (isEmpty(data)) return null;

const { initial, noPrimary, globalInitial, globalNoPrimary } = sentences;
const { initial, noPrimary, globalInitial } = sentences;
const { area_ha, extent, forest_primary } = data;
const { faoYear } = settings;

Expand All @@ -85,10 +85,13 @@ export const parseSentence = createSelector(
}),
country: locationName,
};

let sentence = forest_primary > 0 ? initial : noPrimary;

if (locationName === 'global') {
sentence = forest_primary > 0 ? globalInitial : globalNoPrimary;
sentence = globalInitial;
}

return {
sentence,
params,
Expand Down

0 comments on commit 9baff8e

Please sign in to comment.