Skip to content

Commit b7b00e8

Browse files
committed
Remove duplicate events when events span over multiple months
1 parent c8fb0ee commit b7b00e8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

assets/calendar.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,16 @@ function refreshAggregatedData() {
483483
currentEvents = [];
484484
currentBooks = {};
485485

486+
const seenKeys = new Set();
487+
486488
for (const [, monthData] of monthlyDataCache) {
487-
currentEvents.push(...(monthData.events || []));
489+
for (const ev of monthData.events || []) {
490+
const key = `${ev.book_id}|${ev.start}|${ev.end || ''}`;
491+
if (!seenKeys.has(key)) {
492+
seenKeys.add(key);
493+
currentEvents.push(ev);
494+
}
495+
}
488496
Object.assign(currentBooks, monthData.books || {});
489497
}
490498
}

0 commit comments

Comments
 (0)