Skip to content

Commit

Permalink
Merge pull request #167 from chinyihan/formula_bug
Browse files Browse the repository at this point in the history
Math.round lead to negative sign not showing
  • Loading branch information
nicolaisi authored Jul 4, 2024
2 parents e607953 + f0a4347 commit d26395c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js_plugins/adei.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ function parse_adei(key, value, timestamp, invalid) {
}
} else {
if (data_decimal_numbers != undefined && data_decimal_numbers >= 0) {
value = (Math.round(value * 100) / 100).toFixed(data_decimal_numbers);
if (value >= 0) {
value = (Math.round(value * 100) / 100).toFixed(data_decimal_numbers);
} else {
// negative value
value = ((value * 100) / 100).toFixed(data_decimal_numbers);
}
}
}


if (invalid != undefined && invalid < delta) {
$("#" + key + "> .value").css('color', 'grey');
$("#" + key + "> .unit-name").css('color', 'grey');
Expand Down

0 comments on commit d26395c

Please sign in to comment.