fix stats loading

This commit is contained in:
saml33 2022-06-30 07:58:28 +10:00
parent 87da31e65b
commit a563733b99
1 changed files with 5 additions and 5 deletions

View File

@ -40,11 +40,11 @@ const getAverageStats = (
)
const oldestStat = timeFilteredStats[0]
const latestStat = timeFilteredStats[timeFilteredStats.length - 1]
const avg =
latestStat[type] && oldestStat[type]
? Math.pow(latestStat[type] / oldestStat[type], 365 / daysAgo) * 100 -
100
: null
let avg
if (type in latestStat && type in oldestStat) {
avg =
Math.pow(latestStat[type] / oldestStat[type], 365 / daysAgo) * 100 - 100
}
priorDate.setHours(priorDate.getHours() + 1)