From a46509c7b39cda1c122e712bd0486ae0a76457ee Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Tue, 13 Jun 2017 21:55:51 -0400 Subject: [PATCH] implemented forgotten eta-limit feature --- MMM-MBTA.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MMM-MBTA.js b/MMM-MBTA.js index 25f0c36..84fa249 100644 --- a/MMM-MBTA.js +++ b/MMM-MBTA.js @@ -370,9 +370,7 @@ Module.register("MMM-MBTA", { // This simply doesn't run when the param is empty. var self = this; for (let i = 0; i < this.filterModes.length; i++) { - var temp = rawData.filter(function(obj) { - return (obj.routeType === self.filterModes[i]); - }); + var temp = rawData.filter(obj => (obj.routeType === self.filterModes[i])); // For some reason a for-each loop won't work. for (let x = 0; x < temp.length; x++) { @@ -385,9 +383,11 @@ Module.register("MMM-MBTA", { } // Sorts them according to ETA time - this.stationData.sort(function(a, b) { - return a.preDt - b.preDt; - }); + this.stationData.sort((a,b) => (a.preDt - b.preDt)); + + if (this.config.maxTime !== 0) { + this.stationData = this.stationData.filter(obj => (obj.preAway <= this.config.maxTime * 60)); + } // Shortens the array if (this.stationData.length > this.config.maxEntries) {