Skip to content

Commit 878c25d

Browse files
committed
[Update] government finance currency to constant 2016 USD
1 parent 50a5715 commit 878c25d

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

src/modules/dw/CountryProfile/Resources.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default class Resources {
174174
grantsAsPcOfRevenue,
175175
spendingAllocation,
176176
currencyCode,
177-
currencyUSD: 'constant 2015 USD',
177+
currencyUSD: 'constant 2016 USD',
178178
...domestic,
179179
startYear: maxGovYear < concept.end_year ? maxGovYear : concept.end_year
180180
};
@@ -347,13 +347,13 @@ export default class Resources {
347347
}
348348
private async getResourcesGeneric(id: string, sqlList: string[]): Promise<DH.IResourceDataWithToolTip[]> {
349349
try {
350-
const indicatorArgs: IGetIndicatorArgs[] = sqlList
351-
.map(query => ({ query, ...this.defaultArgs, id }));
352-
const allRaw: IRAWFlow[][] =
353-
await Promise.all(indicatorArgs.map(args => getIndicatorData<IRAWFlow>(args)));
350+
const indicatorArgs: IGetIndicatorArgs[] = sqlList.map(query => ({ query, ...this.defaultArgs, id }));
351+
const allRaw: IRAWFlow[][] = await Promise.all(indicatorArgs.map(args => getIndicatorData<IRAWFlow>(args)));
352+
354353
return Promise.all(allRaw.map(async (raw, index) => {
355354
const data = await this.processResourceData(raw);
356355
const toolTip = await getIndicatorToolTip(indicatorArgs[index]);
356+
357357
return { data, toolTip };
358358
}));
359359
} catch (error) {
@@ -362,17 +362,23 @@ export default class Resources {
362362
}
363363
private async processResourceData(data: IRAWFlow[]): Promise<DH.IResourceData[]> {
364364
try {
365+
console.log(data);
366+
365367
const processed: IFlowProcessed[] = indicatorDataProcessingSimple<IFlowProcessed>(data);
366368
const flowRefs: IFlowRef[] = await getFlows();
367369
const getPosition = Resources.getFlowPositions(flowRefs);
368370
const colors = await getColors();
371+
369372
return processed
370373
.filter(obj => obj.flow_name && obj.flow_name.length)
371374
.map(obj => {
372375
const flow: IFlowRef | undefined = flowRefs.find(flowRef => flowRef.id === obj.flow_name);
373-
if (flow === undefined) { throw new Error(`No flow refrence for ${JSON.stringify(obj)} `); }
376+
if (flow === undefined) {
377+
throw new Error(`No flow refrence for ${JSON.stringify(obj)} `);
378+
}
374379
const colorObj: IColor = getEntityByIdGeneric<IColor>(flow.color, colors);
375380
const position = getPosition(flow);
381+
376382
return { ...obj, ...flow, color: colorObj.value, position, flow_id: flow.id } as DH.IResourceData;
377383
})
378384
.sort((a, b) => Number(a.position) - Number(b.position));

0 commit comments

Comments
 (0)