end added to EpisodeModel

This commit is contained in:
Mark McDowall 2013-06-03 23:10:41 -07:00
parent 6694aaeded
commit 18441aca03
2 changed files with 9 additions and 5 deletions

View File

@ -70,12 +70,10 @@ define(['app', 'Calendar/CalendarItemView'], function () {
var episodeTitle = element.get('title');
var seriesTitle = element.get('series').title;
var start = element.get('airDate');
var end = element.get('endTime');
element.set('title', seriesTitle);
element.set('episodeTitle', episodeTitle);
element.set('start', start);
element.set('end', end);
element.set('allDay', false);
});

View File

@ -24,17 +24,23 @@ define(['app'], function () {
return start.format('{h}.{mm}{tt}');
},
end : function () {
var start = Date.create(this.get('airDate'));
var runtime = this.get('series').runtime;
return start.addMinutes(runtime);
},
statusLevel : function () {
var status = this.get('status');
var episodeFileId = this.get('episodeFileId');
var currentTime = Date.create();
var start = Date.create(this.get('start'));
var start = Date.create(this.get('airDate'));
var end = Date.create(this.get('end'));
if (currentTime.isBetween(start, end)) {
return 'warning';
}
if (start.isBefore(currentTime) || status === 'Missing') {
if (start.isBefore(currentTime) && episodeFileId === 0) {
return 'danger';
}