diff --git a/src/config/mapping/grants/targetsResults.json b/src/config/mapping/grants/targetsResults.json index e82c011..2bc608a 100644 --- a/src/config/mapping/grants/targetsResults.json +++ b/src/config/mapping/grants/targetsResults.json @@ -2,6 +2,8 @@ "dataPath": "value", "module": "activityArea.name", "name": "indicatorName", + "category": "grouping_Level1", + "disaggregation": "grouping_Level2", "reversed": "isReversed", "geoCoverage": "geographicCoverage", "cumulation": "aggregationType", @@ -14,5 +16,5 @@ "target": "targetValuePercentage", "result": "resultValuePercentage", "achievement": "performance", - "urlParams": "?$filter=programmaticDataSet eq 'IMPLEMENTATION_PERIOD_TARGETS_RESULTS' AND implementationPeriod/code eq '' AND valueType eq ''&$expand=activityArea($select=name)&$select=activityArea,indicatorName,isReversed,geographicCoverage,startDate,baselineValuePercentage,baselineValueYear,valueSource,targetValueYear,targetValuePercentage,resultValuePercentage,performance" + "urlParams": "?$filter=programmaticDataSet eq 'IMPLEMENTATION_PERIOD_TARGETS_RESULTS' AND implementationPeriod/code eq '' AND valueType eq ''&$expand=activityArea($select=name)&$select=activityArea,indicatorName,isReversed,geographicCoverage,startDate,baselineValuePercentage,baselineValueYear,valueSource,targetValueYear,targetValuePercentage,resultValuePercentage,performance,grouping_Level1,grouping_Level2" } diff --git a/src/controllers/grants.controller.ts b/src/controllers/grants.controller.ts index e06cdae..f31b766 100644 --- a/src/controllers/grants.controller.ts +++ b/src/controllers/grants.controller.ts @@ -565,6 +565,8 @@ export class GrantsController { .replace('', `${id}P0${ip}`) .replace('', type)}`; + console.log(url); + return axios .get(url) .then((resp: AxiosResponse) => { @@ -614,7 +616,22 @@ export class GrantsController { _.uniq(years), year => year !== 'null' && year !== 'NaN', ); + const category = _.get( + item, + GrantTargetsResultsMapping.category, + '', + ); + const disaggregation = _.get( + item, + GrantTargetsResultsMapping.disaggregation, + '', + ); + let name = undefined; + if (category || disaggregation) { + name = `${category}: ${disaggregation}`; + } let itempush = { + name, reversed: _.get(item, GrantTargetsResultsMapping.reversed, false) === true @@ -668,7 +685,7 @@ export class GrantsController { return { target: target ? `T:${target}%` : '', result: result ? `T:${result}%` : '', - achievement: achievement ? `${achievement}%` : '', + achievement: achievement ? `${achievement * 100}%` : '', }; }), };