NaN detection

This commit is contained in:
Jiang Yio 2022-10-01 01:32:01 -04:00
parent 7b4b9ae099
commit eee1d3b38c

View File

@ -176,7 +176,7 @@
else if(update[deps[j]]) updated = true; else if(update[deps[j]]) updated = true;
if((satisfied) && (updated)) { if((satisfied) && (updated)) {
item = calculation.calc(...calculation.deps.map(x => history[x].value), history[calculation.name] && history[calculation.name].value); item = calculation.calc(...calculation.deps.map(x => history[x].value), history[calculation.name] && history[calculation.name].value);
if((item !== undefined) && (item !== null)) { if((item !== undefined) && (item !== null) && (item === item) && (item != 'NaN')) { // item === item if not NaN
results.push(history[calculation.name] = update[calculation.name] = Object.assign({ time: group.key, value: item }, calculation)); results.push(history[calculation.name] = update[calculation.name] = Object.assign({ time: group.key, value: item }, calculation));
if((item.hasOwnProperty('rangeL')) && (item.value < item.rangeL)) item.flag = 'L'; if((item.hasOwnProperty('rangeL')) && (item.value < item.rangeL)) item.flag = 'L';
else if((item.hasOwnProperty('rangeH')) && (item.value > item.rangeH)) item.flag = 'H'; else if((item.hasOwnProperty('rangeH')) && (item.value > item.rangeH)) item.flag = 'H';