Skip to content

Commit 341347f

Browse files
committed
[Fix] add supportLocalCurrencyOnly to spotlight queries
1 parent 362b5d4 commit 341347f

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ has local government, donor and central government
572572
startYear: number;
573573
currencyUSD: string;
574574
currencyCode: string;
575+
supportLocalCurrencyOnly: boolean;
575576
/**
576577
come from finance file
577578
*/

src/modules/dw/SpotLight/lib/utils.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

2+
import { IColor, getColors, getEntityByIdGeneric } from '../../../refs/global';
23
import * as shortid from 'shortid';
3-
import { addSuffix, approximate, getTotal, isError } from '@devinit/prelude';
44
import { IDB } from '../../../../api/db';
55
import { getConceptAsync } from '../../../refs/concept';
66
import { kenya, uganda } from './sql';
7-
import { IColor, getColors, getEntityByIdGeneric } from '../../../refs/global';
7+
import { addSuffix, approximate, getTotal, isError } from '@devinit/prelude';
88
import * as R from 'ramda';
99
import { IDistrict, getDistrictBySlugAsync } from '../../../refs/spotlight';
1010
import { IBudgetLevelRef, getBudgetLevels } from '../../../refs/countryProfile';
1111
import { IRAW, IRAWDomestic, IRAWPopulationGroup, ISpotlightGetIndicatorArgs } from '../../../utils/types';
1212
import {
13-
addColorToDomesticLevels, domesticDataProcessing, getCurrencyCode,
14-
getIndicatorDataSpotlights, getIndicatorToolTip, getSpotlightTableName
13+
addColorToDomesticLevels, domesticDataProcessing,
14+
getCurrencyInfo, getIndicatorDataSpotlights, getIndicatorToolTip, getSpotlightTableName
1515
} from '../../../utils';
1616

1717
export interface ISpotlightArgs {
@@ -117,14 +117,15 @@ export const getLocalGovernmentFinance = (db: DB) =>
117117
const disaggregated = await domesticDataProcessing(data, country);
118118
return aggregateResources(disaggregated, colors, budgetRefs);
119119
}));
120-
const currencyCode = await getCurrencyCode(country);
120+
const currency = await getCurrencyInfo(country);
121121
// const concept: IConcept =
122122
// await getConceptAsync(conceptType, SpotLight.getTableName('finance', 'uganda'));
123123
return {
124124
startYear,
125-
currencyCode,
125+
currencyCode: currency ? currency.code : 'NCU',
126126
currencyUSD: 'constant 2015 USD',
127127
revenueAndGrants: resources[1],
128+
supportLocalCurrencyOnly: currency ? currency.support_only : false,
128129
expenditure: resources[0]
129130
};
130131
} catch (error) {

src/modules/dw/SpotLight/types.gql

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ type IndicatorValueNCUWithToolTip {
66
}
77

88
type ResourcesBreakDown {
9-
data: IndicatorData!
9+
data: IndicatorData!
1010
toolTip: ToolTip!
1111
}
1212

1313
type OverviewTabRegional {
14-
# WHAT PERCENTAGE OF PEOPLE IN WAKISO LIVE BELOW THE NATIONAL POVERTY LINE?
14+
# WHAT PERCENTAGE OF PEOPLE IN WAKISO LIVE BELOW THE NATIONAL POVERTY LINE?
1515
# can be no data or '12%'
1616
poorestPeople: IndicatorValueWithToolTip
1717
# WHAT RESOURCES ARE AVAILABLE TO LOCAL GOVERNMENTS IN WAKISO? eg 3.6m or 2.7bn
@@ -26,16 +26,16 @@ type OverviewTabRegional {
2626

2727
type PovertyTabKe {
2828
poorestPeople: IndicatorValueWithToolTip
29-
#WHAT IS THE AVERAGE LIFE EXPECTANCY?
29+
#WHAT IS THE AVERAGE LIFE EXPECTANCY?
3030
meanExpenditure: IndicatorValueWithToolTip
31-
#WHAT IS THE STANDARD OF LIVING SCORE?
31+
#WHAT IS THE STANDARD OF LIVING SCORE?
3232
povertyGap: IndicatorValueWithToolTip
3333
}
3434
type PovertyTabUg {
3535
poorestPeople: IndicatorValueWithToolTip
36-
#WHAT IS THE AVERAGE LIFE EXPECTANCY?
36+
#WHAT IS THE AVERAGE LIFE EXPECTANCY?
3737
lifeExpectancy: IndicatorValueWithToolTip
38-
#WHAT IS THE STANDARD OF LIVING SCORE?
38+
#WHAT IS THE STANDARD OF LIVING SCORE?
3939
stdOfLiving: IndicatorValueWithToolTip
4040
}
4141

@@ -57,36 +57,36 @@ type PopulationTabRegionalUg {
5757
}
5858

5959
type EducationTabRegionalUg {
60-
#WHAT IS THE PUPIL–TEACHER RATIO IN PRIMARY EDUCATION?...in government schools and...in all schools
60+
#WHAT IS THE PUPIL–TEACHER RATIO IN PRIMARY EDUCATION?...in government schools and...in all schools
6161
pupilTeacherRatioGovtSchl: IndicatorValueWithToolTip
6262
pupilTeacherRatioOtherSchl: IndicatorValueWithToolTip
63-
#WHAT PERCENTAGE OF STUDENTS PASS THE PRIMARY LEAVING EXAM?
63+
#WHAT PERCENTAGE OF STUDENTS PASS THE PRIMARY LEAVING EXAM?
6464
studentsPassRate: IndicatorValueWithToolTip
6565
studentsPassDistrictRank: IndicatorValueWithToolTip
66-
#HOW MUCH PRIMARY EDUCATION FUNDING IS THERE?
66+
#HOW MUCH PRIMARY EDUCATION FUNDING IS THERE?
6767
primaryEducationfunding: IndicatorValueNCUWithToolTip
6868
}
6969

7070
type EducationTabRegionalKe {
71-
#WHAT IS THE PUPIL–TEACHER RATIO IN PRIMARY EDUCATION?...in government schools and...in all schools
71+
#WHAT IS THE PUPIL–TEACHER RATIO IN PRIMARY EDUCATION?...in government schools and...in all schools
7272
primaryPupilTeacherRatioAllSchl: IndicatorValueWithToolTip
73-
primaryTeacherRatioPublicSchl: IndicatorValueWithToolTip
73+
primaryTeacherRatioPublicSchl: IndicatorValueWithToolTip
7474
primaryTeacherRatioPrivateSchl: IndicatorValueWithToolTip
7575
}
7676

7777
type HealthTabRegionalUg {
7878
#WHAT IS THE DISTRICT LEAGUE HEALTH PERFORMANCE SCORE?
7979
districtPerformance: IndicatorValueWithToolTip
80-
#WHAT PERCENTAGE OF TUBERCULOSIS CASES HAVE BEEN SUCCESSFULLY TREATED?
80+
#WHAT PERCENTAGE OF TUBERCULOSIS CASES HAVE BEEN SUCCESSFULLY TREATED?
8181
treatmeantOfTb: IndicatorValueWithToolTip
8282
districtHealthRank: IndicatorValueWithToolTip
83-
#HOW MUCH LOCAL GOVERNMENT HEALTHCARE FUNDING IS THERE?
83+
#HOW MUCH LOCAL GOVERNMENT HEALTHCARE FUNDING IS THERE?
8484
healthCareFunding: IndicatorValueNCUWithToolTip
8585
}
8686

8787
type HealthTabRegionalKe {
8888
birthAttendanceSkilled: IndicatorValueWithToolTip
89-
contraceptiveUse: IndicatorValueWithToolTip
89+
contraceptiveUse: IndicatorValueWithToolTip
9090
healthCareFunding: IndicatorValueNCUWithToolTip
9191
}
9292

@@ -95,6 +95,7 @@ type LocalGovernmentFinance {
9595
startYear: Int!
9696
currencyUSD: String!
9797
currencyCode: String!
98+
supportLocalCurrencyOnly: Boolean
9899
# come from finance file
99100
revenueAndGrants: [Domestic]!
100101
expenditure: [Domestic]!
@@ -105,7 +106,7 @@ union PopulationTabRegional = PopulationTabRegionalUg | PopulationTabRegionalKe
105106
union EducationTabRegional = EducationTabRegionalUg | EducationTabRegionalKe
106107
union HealthTabRegional = HealthTabRegionalKe | HealthTabRegionalUg
107108

108-
type Query {
109+
type Query {
109110
# id is district slug
110111
overviewTabRegional(id: String!, country: String!):OverviewTabRegional
111112
povertyTabRegional(id: String!, country: String!): PovertyTabRegional

0 commit comments

Comments
 (0)