Fix statistics chart for sum stat without state (#12238)

This commit is contained in:
Erik Montnemery 2022-04-06 20:54:11 +02:00 committed by GitHub
parent aff1ec10bf
commit 1dba849567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,8 +347,8 @@ class StatisticsChart extends LitElement {
statTypes.forEach((type) => {
let val: number | null;
if (type === "sum") {
if (!initVal) {
initVal = val = stat.state;
if (initVal === null) {
initVal = val = stat.state || 0;
prevSum = stat.sum;
} else {
val = initVal + ((stat.sum || 0) - prevSum!);