fixed nullcheck

This commit is contained in:
mKainzbauer
2024-02-11 10:38:24 +01:00
parent a739a86c2c
commit 65f5f8a3c3
2 changed files with 13 additions and 14 deletions
+1 -4
View File
@@ -1,4 +1 @@
.idea/vcs.xml
.idea/misc.xml
.idea/modules.xml
.idea/fuzzy-archer.iml
/.idea/
+12 -10
View File
@@ -483,20 +483,22 @@ function setInnerHTML(element, value) {
}
function aggregate(data, aggregateInterval, aggregateType) {
if(aggregateInterval === undefined || aggregateType === undefined) {
if (aggregateInterval === undefined || aggregateType === undefined) {
return data;
}
let aggregatedData = [];
for (let entry of data) {
//timestamp needs to be shifted one archive_interval to show the readings in the correct time window
if (entry[1] !== undefined) {
setAggregatedChartEntry(entry[1], entry[0] - Number(weewxData.config.archive_interval) * 1000, aggregateInterval, aggregatedData);
if (data !== null && data !== undefined) {
for (let entry of data) {
//timestamp needs to be shifted one archive_interval to show the readings in the correct time window
if (entry[1] !== undefined) {
setAggregatedChartEntry(entry[1], entry[0] - Number(weewxData.config.archive_interval) * 1000, aggregateInterval, aggregatedData);
}
}
}
if (aggregateType === AVG && aggregatedData.length > 0) {
for (let entry of aggregatedData) {
if (entry[2] !== 0) {
entry[1] = entry[1] / entry[2];
if (aggregateType === AVG && aggregatedData.length > 0) {
for (let entry of aggregatedData) {
if (entry[2] !== 0) {
entry[1] = entry[1] / entry[2];
}
}
}
}