From a97a3e44e06214e86f195cfed07d1743fc58ed43 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Fri, 15 Nov 2024 13:24:15 -0800 Subject: [PATCH] fix: show station data when global deployment selected --- .../src/app/services/climate-data.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/picsa-tools/climate-tool/src/app/services/climate-data.service.ts b/apps/picsa-tools/climate-tool/src/app/services/climate-data.service.ts index ef1d676bc..ea27a57a6 100644 --- a/apps/picsa-tools/climate-tool/src/app/services/climate-data.service.ts +++ b/apps/picsa-tools/climate-tool/src/app/services/climate-data.service.ts @@ -24,6 +24,8 @@ export class ClimateDataService { } }); + private stationHashmap = computed(() => arrayToHashmap(this.stations(), 'id')); + constructor(private configurationService: ConfigurationService) { this.stationDataCache = arrayToHashmap(DATA.HARDCODED_STATIONS, 'id'); } @@ -63,8 +65,12 @@ export class ClimateDataService { } private async loadStationSummaries(stationID: string) { - const { country_code } = this.configurationService.deploymentSettings(); - return loadCSV(`assets/summaries/${country_code}/${stationID}.csv`, { + const station = this.stationHashmap()[stationID]; + if (!station) { + return []; + } + const { countryCode, id } = station; + return loadCSV(`assets/summaries/${countryCode}/${id}.csv`, { download: true, dynamicTyping: true, header: true,