mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Broadcast all calendar events while still honoring global and per-calendar maximumEntries
This commit is contained in:
parent
5b1b25fa86
commit
f1f2a61dc8
@ -15,6 +15,8 @@ _This release is scheduled to be released on 2022-10-01._
|
|||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
|
- Broadcast all calendar events while still honoring global and per-calendar maximumEntries.
|
||||||
|
|
||||||
## [2.20.0] - 2022-07-02
|
## [2.20.0] - 2022-07-02
|
||||||
|
|
||||||
Special thanks to the following contributors: @eouia, @khassel, @kolbyjack, @KristjanESPERANTO, @nathannaveen, @naveensrinivasan, @rejas, @rohitdharavath and @sdetweil.
|
Special thanks to the following contributors: @eouia, @khassel, @kolbyjack, @KristjanESPERANTO, @nathannaveen, @naveensrinivasan, @rejas, @rohitdharavath and @sdetweil.
|
||||||
|
@ -493,6 +493,7 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
for (const calendarUrl in this.calendarData) {
|
for (const calendarUrl in this.calendarData) {
|
||||||
const calendar = this.calendarData[calendarUrl];
|
const calendar = this.calendarData[calendarUrl];
|
||||||
|
let remainingEntries = this.maximumEntriesForUrl(calendarUrl);
|
||||||
for (const e in calendar) {
|
for (const e in calendar) {
|
||||||
const event = JSON.parse(JSON.stringify(calendar[e])); // clone object
|
const event = JSON.parse(JSON.stringify(calendar[e])); // clone object
|
||||||
|
|
||||||
@ -510,6 +511,9 @@ Module.register("calendar", {
|
|||||||
if (this.listContainsEvent(events, event)) {
|
if (this.listContainsEvent(events, event)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (--remainingEntries < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
event.url = calendarUrl;
|
event.url = calendarUrl;
|
||||||
event.today = event.startDate >= today && event.startDate < today + 24 * 60 * 60 * 1000;
|
event.today = event.startDate >= today && event.startDate < today + 24 * 60 * 60 * 1000;
|
||||||
@ -718,6 +722,16 @@ Module.register("calendar", {
|
|||||||
return this.getCalendarProperty(url, "repeatingCountTitle", this.config.defaultRepeatingCountTitle);
|
return this.getCalendarProperty(url, "repeatingCountTitle", this.config.defaultRepeatingCountTitle);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the maximum entry count for a specific calendar url.
|
||||||
|
*
|
||||||
|
* @param {string} url The calendar url
|
||||||
|
* @returns {int} The maximum entry count
|
||||||
|
*/
|
||||||
|
maximumEntriesForUrl: function (url) {
|
||||||
|
return this.getCalendarProperty(url, "maximumEntries", this.config.maximumEntries);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to retrieve the property for a specific calendar url.
|
* Helper method to retrieve the property for a specific calendar url.
|
||||||
*
|
*
|
||||||
|
@ -498,8 +498,7 @@ const CalendarUtils = {
|
|||||||
return a.startDate - b.startDate;
|
return a.startDate - b.startDate;
|
||||||
});
|
});
|
||||||
|
|
||||||
let maxEvents = newEvents.slice(0, config.maximumEntries);
|
return newEvents;
|
||||||
return maxEvents;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user