2013-06-25 02:41:59 +03:00
|
|
|
'use strict';
|
|
|
|
define(
|
|
|
|
[
|
2013-08-05 12:09:41 +03:00
|
|
|
'backbone',
|
|
|
|
'Series/SeasonModel'
|
|
|
|
], function (Backbone, SeasonModel) {
|
|
|
|
return Backbone.Collection.extend({
|
2013-06-25 02:41:59 +03:00
|
|
|
url : window.ApiRoot + '/season',
|
|
|
|
model: SeasonModel,
|
2013-05-12 18:53:39 +03:00
|
|
|
|
2013-08-05 12:09:41 +03:00
|
|
|
comparator: function (season) {
|
|
|
|
return -season.get('seasonNumber');
|
2013-06-25 02:41:59 +03:00
|
|
|
},
|
2013-05-12 18:53:39 +03:00
|
|
|
|
2013-08-05 12:09:41 +03:00
|
|
|
bySeries: function (series) {
|
|
|
|
var filtered = this.filter(function (season) {
|
|
|
|
return season.get('seriesId') === series;
|
|
|
|
});
|
|
|
|
|
|
|
|
var SeasonCollection = require('Series/SeasonCollection');
|
|
|
|
|
|
|
|
return new SeasonCollection(filtered);
|
2013-06-25 02:41:59 +03:00
|
|
|
}
|
|
|
|
});
|
2013-03-04 01:42:26 +03:00
|
|
|
});
|