Skip to content

Commit 32ce8ba

Browse files
authored
Merge pull request #5616 from Countly/stats-dp
[SER-1982] [server-stats] Fix data point calculation
2 parents d9a3210 + afb6d9b commit 32ce8ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/server-stats/api/parts/stats.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function fetchDatapoints(db, filter, options, callback) {
246246
if (options.monthlyBreakdown) {
247247
const dataPoints = result
248248
.reduce((acc, current) => {
249-
let dp = current.e + current.s;
249+
let dp = (current.e || 0) + (current.s || 0);
250250

251251
if (/^\[CLY\]_consolidated/.test(current._id)) {
252252
// do not count consolidated dp for countly hosted clients
@@ -415,4 +415,4 @@ function getAppName(appId, appNames) {
415415
}
416416

417417

418-
module.exports = {updateDataPoints, isConsolidated, increaseDataPoints, punchCard, fetchDatapoints, getTop, getAppName, internalEventsEnum};
418+
module.exports = {updateDataPoints, isConsolidated, increaseDataPoints, punchCard, fetchDatapoints, getTop, getAppName, internalEventsEnum};

0 commit comments

Comments
 (0)