Skip to content

Commit

Permalink
fix: show station data when global deployment selected
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismclarke committed Nov 15, 2024
1 parent 295f9b2 commit a97a3e4
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 a97a3e4

Please sign in to comment.