Skip to content

Commit

Permalink
Merge pull request #343 from e-picsa/fix/global-station-data
Browse files Browse the repository at this point in the history
fix: show station data when global deployment selected
  • Loading branch information
chrismclarke authored Nov 15, 2024
2 parents 295f9b2 + a97a3e4 commit 43d0d28
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -63,8 +65,12 @@ export class ClimateDataService {
}

private async loadStationSummaries(stationID: string) {
const { country_code } = this.configurationService.deploymentSettings();
return loadCSV<IStationData>(`assets/summaries/${country_code}/${stationID}.csv`, {
const station = this.stationHashmap()[stationID];
if (!station) {
return [];
}
const { countryCode, id } = station;
return loadCSV<IStationData>(`assets/summaries/${countryCode}/${id}.csv`, {
download: true,
dynamicTyping: true,
header: true,
Expand Down

0 comments on commit 43d0d28

Please sign in to comment.