properly handle switching to a reading type that doesn't have any readings at all

This commit is contained in:
Starbeamrainbowlabs 2021-01-30 21:40:07 +00:00
parent 3dc7b58e6e
commit f78c52d8f1
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 9 additions and 1 deletions

View file

@ -13,6 +13,7 @@ This is the changelog for the air quality web interface and its associated HTTP
## v0.14
- Remove the heatmap background overlay :-(
- Colour device markers based on the latest reading
- Properly handle switching to a reading type that doesn't have any readings at all
- [API] Optimise `list-reading-types` action, which necessitated a database schema update and the removal of the `count` property on returned objects
- [API] Drastically optimise `device-info` by removing a redundant JOIN

View file

@ -57,7 +57,14 @@ class LayerDeviceMarkers extends Emitter {
// 3: Fetch the latest readings data
// --------------------------------------------------------------------
let device_values = await this.map_manager.readings_data.fetch(reading_type, datetime);
let device_values;
try {
device_values = await this.map_manager.readings_data.fetch(reading_type, datetime);
}
catch(error) {
alert(error);
device_values = new Map();
}
// 4: Add a marker for each device
// --------------------------------------------------------------------