currentEvent ninja edit
This commit is contained in:
parent
dd3207b060
commit
55950327fb
12
schedule.js
12
schedule.js
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue