1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed #383 - Visualize shows distance and area as "undefined/NaN"

This commit is contained in:
Jon Ziebell 2023-01-24 16:55:44 -05:00
parent b739ea15b2
commit 9729bc8cd0

View File

@ -188,27 +188,27 @@ beestat.layer.load.prototype.decorate_ = function(parent) {
'USA', 'USA',
'CAN' 'CAN'
]; ];
if ( if (
beestat.setting('units.distance') === undefined && beestat.setting('units.distance') === undefined ||
thermostat.address_id !== null && beestat.setting('units.area') === undefined
beestat.address.is_valid(thermostat.address_id) === true
) { ) {
const address = beestat.cache.address[thermostat.address_id]; if (
beestat.setting( thermostat.address_id !== null &&
'units.distance', beestat.address.is_valid(thermostat.address_id) === true
imperial_countries.includes(address.normalized.components.country_iso_3) === true ? 'ft' : 'm' ) {
); const address = beestat.cache.address[thermostat.address_id];
} beestat.setting({
if ( 'units.distance': imperial_countries.includes(address.normalized.components.country_iso_3) === true ? 'ft' : 'm',
beestat.setting('units.area') === undefined && 'units.area': imperial_countries.includes(address.normalized.components.country_iso_3) === true ? 'ft²' : 'm²'
thermostat.address_id !== null && });
beestat.address.is_valid(thermostat.address_id) === true } else {
) { // Assume ft/ft² if invalid address.
const address = beestat.cache.address[thermostat.address_id]; beestat.setting({
beestat.setting( 'units.distance': 'ft',
'units.area', 'units.area': 'ft²'
imperial_countries.includes(address.normalized.components.country_iso_3) === true ? 'ft²' : 'm²' });
); }
} }
// Currency (USD is default) // Currency (USD is default)