Skip to content

Commit

Permalink
chore(tcl): remove validations from MVP tickets 1075 and 1077
Browse files Browse the repository at this point in the history
  • Loading branch information
wri7tno authored and willian-viana committed Apr 25, 2024
1 parent 305515c commit b358631
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 39 deletions.
4 changes: 1 addition & 3 deletions components/widgets/fires/tree-loss-fires-annual/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,8 @@ export default {
return lossFetch.then((loss) => {
let data = {};
if (loss && loss.data) {
const filteredLoss = loss.data.data.filter((item) => item.year < 2023);

data = {
loss: filteredLoss,
loss: loss.data.data,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const parseSentence = createSelector(
indicator: indicator && indicator.label,
location: locationLabel,
startYear,
endYear: endYear === 2023 ? endYear - 1 : endYear, // TODO: Remove this for TCL 2023 update full release!!
endYear,
treeCoverLossFires: formatNumber({
num: treeCoverLossFires,
unit: 'ha',
Expand Down
4 changes: 1 addition & 3 deletions components/widgets/fires/tree-loss-fires-proportion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ export default {
return lossFetch.then((loss) => {
let data = {};
if (loss && loss.data) {
const filteredLoss = loss.data.data.filter((item) => item.year < 2023);

data = {
loss: filteredLoss,
loss: loss.data.data,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const parseSentence = createSelector(
indicator: indicator && indicator.label,
location: locationLabel,
startYear,
endYear: endYear === 2023 ? endYear - 1 : endYear, // TODO: Remove this for TCL 2023 update full release!!,
endYear,
lossFiresPercentage: formatNumber({
num: lossFiresPercentage,
unit: '%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export default {
landCategory: 'tsc',
lossTsc: true,
download: true,
widgetId: 'treeLossTsc',
}),
getExtent({ ...params, download: true }),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,7 @@ export const parseSentence = createSelector(
const percentageLoss =
(totalLoss && totalExtent && (totalLoss / totalExtent) * 100) || 0;

let sentence = indicator ? withInd : initial;

if (endYear === 2023) {
sentence = sentence.replace(' and {emissions} of CO₂ emissions', '');
}
const sentence = indicator ? withInd : initial;

const params = {
indicator: indicator && indicator.label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,8 @@ export const parseSentence = createSelector(
percentage: formatNumber({ num: percentage, unit: '%' }),
};

let finalSentence = sentence;

if (endYear === 2023) {
finalSentence = sentence.replace(
' The total loss within natural forest was equivalent to {value} of CO\u2082e emissions.',
''
);
}

return {
sentence: finalSentence,
sentence,
params,
};
}
Expand Down
8 changes: 1 addition & 7 deletions services/get-where-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isNumber = (value) => !!(typeof value === 'number' || !isNaN(value));

// build {where} statement for query
export const getWHEREQuery = (params = {}) => {
const { type, dataset, widgetId } = params || {};
const { type, dataset } = params || {};

const allFilterOptions = forestTypes.concat(landCategories);
const allowedParams = ALLOWED_PARAMS[params.dataset || 'annual'];
Expand Down Expand Up @@ -97,12 +97,6 @@ export const getWHEREQuery = (params = {}) => {
}`;
}

// this is a temporary patch, it should be removed soon for the full TCL release!!
// see https://gfw.atlassian.net/browse/FLAG-1077
if (widgetId === 'treeLossTsc') {
WHERE = `${WHERE} AND umd_tree_cover_loss__year < 2023 `;
}

if (isLastParameter) {
WHERE = `${WHERE} `;
} else {
Expand Down
8 changes: 0 additions & 8 deletions services/sentences.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,6 @@ export const parseSentence = (
sentence = countrySpecific[adm0];
}

// 2023 TCL MVP
// removing last part of paragraph
// see: https://gfw.atlassian.net/browse/FLAG-1070
sentence = sentence.replace(
', equivalent to {emissions} of CO₂ emissions',
''
);

return {
sentence,
params,
Expand Down

0 comments on commit b358631

Please sign in to comment.