end added to EpisodeModel

pull/4/head
Mark McDowall 12 years ago
parent 6694aaeded
commit 18441aca03

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

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

Loading…
Cancel
Save