currentEvent ninja edit

This commit is contained in:
Petko Bordjukov 2014-06-21 10:55:38 +03:00
parent dd3207b060
commit 55950327fb
1 changed files with 6 additions and 6 deletions

View File

@ -19,13 +19,13 @@ function Schedule() {
} }
this.currentEvent = function() { this.currentEvent = function() {
var latestEvent = _.last(this.pastEvents());
var nextEvent = this.nextEvent(); var nextEvent = this.nextEvent();
if (typeof nextEvent != 'undefined' && nextEvent.startTime.subtract('10', 'minutes').isAfter(moment())) {
return _.last( return latestEvent;
_.select(this.pastEvents(), function(event) { } else {
return event.startTime.isAfter(nextEvent.startTime.subtract('20', 'minutes')); return undefined;
}) }
);
} }
this.futureEvents = function() { this.futureEvents = function() {