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() {
var latestEvent = _.last(this.pastEvents());
var nextEvent = this.nextEvent();
return _.last(
_.select(this.pastEvents(), function(event) {
return event.startTime.isAfter(nextEvent.startTime.subtract('20', 'minutes'));
})
);
if (typeof nextEvent != 'undefined' && nextEvent.startTime.subtract('10', 'minutes').isAfter(moment())) {
return latestEvent;
} else {
return undefined;
}
}
this.futureEvents = function() {