Skip to content

Commit 6995276

Browse files
e11syCopilot
andauthored
Update src/models/eventsFactory.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4943c4c commit 6995276

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/models/eventsFactory.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,12 @@ class EventsFactory extends Factory {
439439

440440
const key = `groupingTimestamp:${groupingTimestamp}`;
441441
const current = groupedCounts[key] || 0;
442-
groupedCounts[key] = current + (item.count ?? 0);
442+
if (item.count === undefined || item.count === null) {
443+
console.warn(`Missing 'count' field for daily event with key ${key}. Defaulting to 0.`);
444+
groupedCounts[key] = current;
445+
} else {
446+
groupedCounts[key] = current + item.count;
447+
}
443448
}
444449

445450

0 commit comments

Comments
 (0)