2013-06-25 01:41:59 +02:00
|
|
|
|
'use strict';
|
|
|
|
|
define(
|
|
|
|
|
[
|
2013-08-05 11:09:41 +02:00
|
|
|
|
'backbone',
|
|
|
|
|
'Series/SeasonModel'
|
|
|
|
|
], function (Backbone, SeasonModel) {
|
|
|
|
|
return Backbone.Collection.extend({
|
2013-06-25 01:41:59 +02:00
|
|
|
|
url : window.ApiRoot + '/season',
|
|
|
|
|
model: SeasonModel,
|
2013-05-12 17:53:39 +02:00
|
|
|
|
|
2013-08-05 11:09:41 +02:00
|
|
|
|
comparator: function (season) {
|
|
|
|
|
return -season.get('seasonNumber');
|
2013-06-25 01:41:59 +02:00
|
|
|
|
},
|
2013-05-12 17:53:39 +02:00
|
|
|
|
|
2013-08-05 11:09:41 +02: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 01:41:59 +02:00
|
|
|
|
}
|
|
|
|
|
});
|
2013-03-03 23:42:26 +01:00
|
|
|
|
});
|