From 2d03ff63cf7b7a794e7e41b20ec6b41fe8a1ad0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Cederstr=C3=B6m?= Date: Sun, 1 Oct 2017 21:36:43 +0200 Subject: [PATCH] Slice the list of all events to honor config.maximumEntries Scenario: * Specify more than one calendar in `config.calendars` * Specify a maximum number of entries in `config.maximumEntries` Result: The module will show as many as maximumEntries for EACH calendar Expected: The module shall not show more than a total of maximumEntries, regardless of how many calendars I specify Fixes #1043 --- CHANGELOG.md | 3 +++ modules/default/calendar/calendar.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 380ab383..39b24d30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Updated +### Fixed +- Fixed issue with calendar module showing more than `maximumEntries` allows + ## [2.1.3] - 2017-10-01 **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install` diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index ad3be8ce..6e629997 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -356,7 +356,7 @@ Module.register("calendar", { return a.startDate - b.startDate; }); - return events; + return events.slice(0, this.config.maximumEntries); }, /* createEventList(url)