From 4ec220a3e564ee3e5c8fef7f27842c0c30cc8ddd Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Mon, 17 Jul 2023 08:43:24 +0200 Subject: [PATCH] fix: add km and MWK units in middle column AB#20153 --- .../aggregates/aggregates.component.html | 1 + .../migration/1689575782230-aggregateUnit.ts | 17 +++++++++++++++++ .../api/metadata/indicator-metadata.entity.ts | 4 ++++ .../src/scripts/json/indicator-metadata.json | 16 +++++++++------- 4 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 services/API-service/migration/1689575782230-aggregateUnit.ts diff --git a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html index f5d12ad83..296d10ec5 100644 --- a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html +++ b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html @@ -85,6 +85,7 @@ ) | percent: '.0-0' }} + {{ indicator.aggregateUnit }} diff --git a/services/API-service/migration/1689575782230-aggregateUnit.ts b/services/API-service/migration/1689575782230-aggregateUnit.ts new file mode 100644 index 000000000..696b88331 --- /dev/null +++ b/services/API-service/migration/1689575782230-aggregateUnit.ts @@ -0,0 +1,17 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class aggregateUnit1689575782230 implements MigrationInterface { + name = 'aggregateUnit1689575782230'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "IBF-app"."indicator-metadata" ADD "aggregateUnit" character varying`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "IBF-app"."indicator-metadata" DROP COLUMN "aggregateUnit"`, + ); + } +} diff --git a/services/API-service/src/api/metadata/indicator-metadata.entity.ts b/services/API-service/src/api/metadata/indicator-metadata.entity.ts index 8ac040329..b53a821dc 100644 --- a/services/API-service/src/api/metadata/indicator-metadata.entity.ts +++ b/services/API-service/src/api/metadata/indicator-metadata.entity.ts @@ -80,6 +80,10 @@ export class IndicatorMetadataEntity { @Column({ nullable: true }) public unit: string; + @ApiProperty({ example: 'km' }) + @Column({ nullable: true }) + public aggregateUnit: string; + @ApiProperty() @Column({ default: false }) public lazyLoad: boolean; diff --git a/services/API-service/src/scripts/json/indicator-metadata.json b/services/API-service/src/scripts/json/indicator-metadata.json index 5f844c9b2..8442a03a6 100644 --- a/services/API-service/src/scripts/json/indicator-metadata.json +++ b/services/API-service/src/scripts/json/indicator-metadata.json @@ -1267,7 +1267,8 @@ "order": 2, "dynamic": true, "lazyLoad": true, - "unit": "$" + "unit": "MWK", + "aggregateUnit": "MWK" }, { "countryCodes": "MWI", @@ -1285,7 +1286,8 @@ "order": 2, "dynamic": true, "lazyLoad": true, - "unit": "nr. of roads" + "unit": "km", + "aggregateUnit": "km" }, { "countryCodes": "MWI", @@ -1303,13 +1305,13 @@ "order": 2, "dynamic": true, "lazyLoad": true, - "unit": "nr. of schools" + "unit": "schools" }, { "countryCodes": "MWI", "disasterTypes": ["flash-floods"], "name": "nr_affected_clinics", - "label": "Affected clinics", + "label": "Affected health sites", "icon": "Clinics_affected.svg", "weightedAvg": false, "active": "no", @@ -1321,7 +1323,7 @@ "order": 2, "dynamic": true, "lazyLoad": true, - "unit": "nr. of clinics" + "unit": "health sites" }, { "countryCodes": "MWI", @@ -1339,7 +1341,7 @@ "order": 2, "dynamic": true, "lazyLoad": true, - "unit": "nr. of waterpoints" + "unit": "waterpoints" }, { "countryCodes": "MWI", @@ -1357,7 +1359,7 @@ "order": 2, "dynamic": true, "lazyLoad": true, - "unit": "nr. of buildings" + "unit": "buildings" }, { "countryCodes": "KEN",