Move filter function into seperate method

This commit is contained in:
rejas 2020-12-25 12:59:08 +01:00
parent 9b93066cbe
commit 0ac5032db9

View File

@ -90,13 +90,19 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
try { try {
data = ical.parseICS(responseData); data = ical.parseICS(responseData);
Log.debug("parsed data=" + JSON.stringify(data));
filterEvents(data);
} catch (error) { } catch (error) {
fetchFailedCallback(self, error.message); fetchFailedCallback(self, error.message);
scheduleTimer(); scheduleTimer();
return;
} }
self.broadcastEvents();
scheduleTimer();
});
};
Log.debug(" parsed data=" + JSON.stringify(data)); const filterEvents = function (data) {
const newEvents = []; const newEvents = [];
// limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves // limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves
@ -419,10 +425,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
if (entries > maximumEntries) break; if (entries > maximumEntries) break;
events.push(ne); events.push(ne);
} }
self.broadcastEvents();
scheduleTimer();
});
}; };
/** /**