mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-04 06:46:05 +00:00
Merge branch 'develop' into issue_1926
This commit is contained in:
commit
9831f81b6e
@ -37,6 +37,7 @@ _This release is scheduled to be released on 2020-07-01._
|
|||||||
- Support multiple instances of calendar module with different config [#1109](https://github.com/MichMich/MagicMirror/issues/1109)
|
- Support multiple instances of calendar module with different config [#1109](https://github.com/MichMich/MagicMirror/issues/1109)
|
||||||
- Fix the use of "maxNumberOfDays" in the module "weatherforecast" [#2018](https://github.com/MichMich/MagicMirror/issues/2018)
|
- Fix the use of "maxNumberOfDays" in the module "weatherforecast" [#2018](https://github.com/MichMich/MagicMirror/issues/2018)
|
||||||
- Throw error when check_config fails [#1928](https://github.com/MichMich/MagicMirror/issues/1928)
|
- Throw error when check_config fails [#1928](https://github.com/MichMich/MagicMirror/issues/1928)
|
||||||
|
- Bug fix related to 'maxEntries' not displaying Calendar events. [#2050](https://github.com/MichMich/MagicMirror/issues/2050)
|
||||||
- Updated ical library to latest version [#1926](https://github.com/MichMich/MagicMirror/issues/1926)
|
- Updated ical library to latest version [#1926](https://github.com/MichMich/MagicMirror/issues/1926)
|
||||||
|
|
||||||
## [2.11.0] - 2020-04-01
|
## [2.11.0] - 2020-04-01
|
||||||
|
@ -9,7 +9,7 @@ const ical = require("ical");
|
|||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
const request = require("request");
|
const request = require("request");
|
||||||
|
|
||||||
const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents) {
|
const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNumberOfDays, auth, includePastEvents) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
let reloadTimer = null;
|
let reloadTimer = null;
|
||||||
@ -218,12 +218,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
let curEvent = event;
|
let curEvent = event;
|
||||||
let showRecurrence = true;
|
let showRecurrence = true;
|
||||||
|
|
||||||
// Stop parsing this event's recurrences if we've already found maximumEntries worth of recurrences.
|
|
||||||
// (The logic below would still filter the extras, but the check is simple since we're already tracking the count)
|
|
||||||
if (addedEvents >= maximumEntries) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
startDate = moment(date);
|
startDate = moment(date);
|
||||||
|
|
||||||
// For each date that we're checking, it's possible that there is a recurrence override for that one day.
|
// For each date that we're checking, it's possible that there is a recurrence override for that one day.
|
||||||
@ -256,7 +250,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
showRecurrence = false;
|
showRecurrence = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showRecurrence === true && addedEvents < maximumEntries) {
|
if (showRecurrence === true) {
|
||||||
addedEvents++;
|
addedEvents++;
|
||||||
newEvents.push({
|
newEvents.push({
|
||||||
title: recurrenceTitle,
|
title: recurrenceTitle,
|
||||||
@ -326,7 +320,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
return a.startDate - b.startDate;
|
return a.startDate - b.startDate;
|
||||||
});
|
});
|
||||||
|
|
||||||
events = newEvents.slice(0, maximumEntries);
|
events = newEvents;
|
||||||
|
|
||||||
self.broadcastEvents();
|
self.broadcastEvents();
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
|
@ -20,7 +20,7 @@ module.exports = NodeHelper.create({
|
|||||||
// Override socketNotificationReceived method.
|
// Override socketNotificationReceived method.
|
||||||
socketNotificationReceived: function (notification, payload) {
|
socketNotificationReceived: function (notification, payload) {
|
||||||
if (notification === "ADD_CALENDAR") {
|
if (notification === "ADD_CALENDAR") {
|
||||||
this.createFetcher(payload.url, payload.fetchInterval, payload.excludedEvents, payload.maximumEntries, payload.maximumNumberOfDays, payload.auth, payload.broadcastPastEvents, payload.id);
|
this.createFetcher(payload.url, payload.fetchInterval, payload.excludedEvents, payload.maximumNumberOfDays, payload.auth, payload.broadcastPastEvents, payload.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ module.exports = NodeHelper.create({
|
|||||||
* attribute url string - URL of the news feed.
|
* attribute url string - URL of the news feed.
|
||||||
* attribute reloadInterval number - Reload interval in milliseconds.
|
* attribute reloadInterval number - Reload interval in milliseconds.
|
||||||
*/
|
*/
|
||||||
createFetcher: function (url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, broadcastPastEvents, identifier) {
|
createFetcher: function (url, fetchInterval, excludedEvents, maximumNumberOfDays, auth, broadcastPastEvents, identifier) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!validUrl.isUri(url)) {
|
if (!validUrl.isUri(url)) {
|
||||||
@ -42,7 +42,7 @@ module.exports = NodeHelper.create({
|
|||||||
var fetcher;
|
var fetcher;
|
||||||
if (typeof self.fetchers[identifier + url] === "undefined") {
|
if (typeof self.fetchers[identifier + url] === "undefined") {
|
||||||
Log.log("Create new calendar fetcher for url: " + url + " - Interval: " + fetchInterval);
|
Log.log("Create new calendar fetcher for url: " + url + " - Interval: " + fetchInterval);
|
||||||
fetcher = new CalendarFetcher(url, fetchInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, broadcastPastEvents);
|
fetcher = new CalendarFetcher(url, fetchInterval, excludedEvents, maximumNumberOfDays, auth, broadcastPastEvents);
|
||||||
|
|
||||||
fetcher.onReceive(function (fetcher) {
|
fetcher.onReceive(function (fetcher) {
|
||||||
self.sendSocketNotification("CALENDAR_EVENTS", {
|
self.sendSocketNotification("CALENDAR_EVENTS", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user