Skip to content

Commit

Permalink
feat: targets & results table more info
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanoshadjipetrou committed Aug 13, 2024
1 parent 789671f commit 96079b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/config/mapping/grants/targetsResults.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataPath": "value",
"module": "activityArea.name",
"name": "indicatorName",
"category": "grouping_Level1",
"disaggregation": "grouping_Level2",
"reversed": "isReversed",
"geoCoverage": "geographicCoverage",
"cumulation": "aggregationType",
Expand All @@ -14,5 +16,5 @@
"target": "targetValuePercentage",
"result": "resultValuePercentage",
"achievement": "performance",
"urlParams": "?$filter=programmaticDataSet eq 'IMPLEMENTATION_PERIOD_TARGETS_RESULTS' AND implementationPeriod/code eq '<grantIP>' AND valueType eq '<type>'&$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 '<grantIP>' AND valueType eq '<type>'&$expand=activityArea($select=name)&$select=activityArea,indicatorName,isReversed,geographicCoverage,startDate,baselineValuePercentage,baselineValueYear,valueSource,targetValueYear,targetValuePercentage,resultValuePercentage,performance,grouping_Level1,grouping_Level2"
}
19 changes: 18 additions & 1 deletion src/controllers/grants.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ export class GrantsController {
.replace('<grantIP>', `${id}P0${ip}`)
.replace('<type>', type)}`;

console.log(url);

return axios
.get(url)
.then((resp: AxiosResponse) => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -668,7 +685,7 @@ export class GrantsController {
return {
target: target ? `T:${target}%` : '',
result: result ? `T:${result}%` : '',
achievement: achievement ? `${achievement}%` : '',
achievement: achievement ? `${achievement * 100}%` : '',
};
}),
};
Expand Down

0 comments on commit 96079b6

Please sign in to comment.