mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Less model pollution
This commit is contained in:
parent
488da59143
commit
8e2364966a
8 changed files with 26 additions and 31 deletions
|
@ -50,6 +50,7 @@ define(
|
|||
{
|
||||
name : 'this',
|
||||
label : 'Title',
|
||||
hideSeriesLink : true,
|
||||
cell : EpisodeTitleCell,
|
||||
sortable: false
|
||||
},
|
||||
|
@ -74,10 +75,6 @@ define(
|
|||
|
||||
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
|
||||
|
||||
_.each(this.episodeCollection.models, function (episode) {
|
||||
episode.set({ hideSeriesLink: true, series: options.series });
|
||||
});
|
||||
|
||||
this.listenTo(this.model, 'sync', function () {
|
||||
this._afterSeasonMonitored();
|
||||
}, this);
|
||||
|
|
|
@ -8,17 +8,7 @@ define(
|
|||
], function (Backbone, Moment, SeriesModel, EpisodeFileModel) {
|
||||
return Backbone.Model.extend({
|
||||
|
||||
initialize: function () {
|
||||
if (this.has('series')) {
|
||||
var start = Moment(this.get('airDateUtc'));
|
||||
var runtime = this.get('series').get('runtime');
|
||||
|
||||
this.set('end', start.add('minutes', runtime));
|
||||
}
|
||||
},
|
||||
|
||||
parse: function (model) {
|
||||
model.series = new SeriesModel(model.series);
|
||||
|
||||
if (model.episodeFile) {
|
||||
model.episodeFile = new EpisodeFileModel(model.episodeFile);
|
||||
|
@ -27,15 +17,6 @@ define(
|
|||
return model;
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
var json = _.clone(this.attributes);
|
||||
|
||||
if (this.has('series')) {
|
||||
json.series = this.get('series').toJSON();
|
||||
}
|
||||
return json;
|
||||
},
|
||||
|
||||
defaults: {
|
||||
seasonNumber: 0,
|
||||
status : 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue