Skip to content

Commit 62ff4d1

Browse files
committed
chore(): lint fix
1 parent 6995276 commit 62ff4d1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/models/eventsFactory.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,14 @@ class EventsFactory extends Factory {
424424
};
425425
}
426426

427-
let dailyEventsCursor = await this.getCollection(this.TYPES.DAILY_EVENTS)
428-
.find(options, { projection: { lastRepetitionTime: 1, groupingTimestamp: 1, count: 1 } })
427+
const dailyEventsCursor = await this.getCollection(this.TYPES.DAILY_EVENTS)
428+
.find(options, {
429+
projection: {
430+
lastRepetitionTime: 1,
431+
groupingTimestamp: 1,
432+
count: 1,
433+
},
434+
})
429435
.batchSize(MAX_DB_READ_BATCH_SIZE);
430436

431437
const groupedCounts = {};
@@ -439,6 +445,7 @@ class EventsFactory extends Factory {
439445

440446
const key = `groupingTimestamp:${groupingTimestamp}`;
441447
const current = groupedCounts[key] || 0;
448+
442449
if (item.count === undefined || item.count === null) {
443450
console.warn(`Missing 'count' field for daily event with key ${key}. Defaulting to 0.`);
444451
groupedCounts[key] = current;
@@ -447,7 +454,6 @@ class EventsFactory extends Factory {
447454
}
448455
}
449456

450-
451457
/**
452458
* Now fill all requested days
453459
*/
@@ -458,9 +464,15 @@ class EventsFactory extends Factory {
458464
const day = new Date(now.setDate(now.getDate() - i));
459465
const dayMidnight = getUTCMidnight(day) / 1000;
460466

467+
let groupedCount = groupedCounts[`groupingTimestamp:${dayMidnight}`];
468+
469+
if (!groupedCount) {
470+
groupedCount = 0;
471+
}
472+
461473
result.push({
462474
timestamp: dayMidnight,
463-
count: groupedCounts[`groupingTimestamp:${dayMidnight}`] ?? 0,
475+
count: groupedCount,
464476
});
465477
}
466478

0 commit comments

Comments
 (0)