Skip to content

Commit

Permalink
implemented forgotten eta-limit feature
Browse files Browse the repository at this point in the history
  • Loading branch information
edward-shen committed Jun 14, 2017
1 parent 5aabcd3 commit a46509c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions MMM-MBTA.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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) {
Expand Down

0 comments on commit a46509c

Please sign in to comment.