Bugfix: Default to the 1st reading type if we can't find PM25

This commit is contained in:
Starbeamrainbowlabs 2019-02-10 13:40:23 +00:00
parent 502dc9a062
commit 3c9fe2a6d9
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 6 additions and 0 deletions

View file

@ -1,5 +1,8 @@
# Changelog # Changelog
## v0.3.2 - 10th February 2019
- Bugfix: Default to something sensible when opening the device graph in certain cases
## v0.3.1 - 7th February 2019 ## v0.3.1 - 7th February 2019
- Hidden measurement types in the device graph if a device hasn't reported any readings of that type - Hidden measurement types in the device graph if a device hasn't reported any readings of that type

View file

@ -68,6 +68,9 @@ class DeviceReadingDisplay {
await this.fetch_reading_types(); await this.fetch_reading_types();
this.reading_type = this.reading_types.find((type) => type.id == default_reading_type); this.reading_type = this.reading_types.find((type) => type.id == default_reading_type);
// Default to the 1st reading type if we can't find the default
if(typeof this.reading_type == "undefined")
this.reading_type = this.reading_types[0].id;
// Create the reading type buttons // Create the reading type buttons
let reading_type_list = this.display.querySelector(".reading-types"); let reading_type_list = this.display.querySelector(".reading-types");