mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-28 04:51:45 +02:00
Fixed: Initial sorting for Next Airing
This commit is contained in:
@@ -6,8 +6,9 @@ define(
|
||||
'backbone.pageable',
|
||||
'Series/SeriesModel',
|
||||
'api!series',
|
||||
'Mixins/AsPersistedStateCollection'
|
||||
], function (_, Backbone, PageableCollection, SeriesModel, SeriesData, AsPersistedStateCollection) {
|
||||
'Mixins/AsPersistedStateCollection',
|
||||
'moment'
|
||||
], function (_, Backbone, PageableCollection, SeriesModel, SeriesData, AsPersistedStateCollection, Moment) {
|
||||
var Collection = PageableCollection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/series',
|
||||
model: SeriesModel,
|
||||
@@ -19,6 +20,18 @@ define(
|
||||
pageSize: 1000
|
||||
},
|
||||
|
||||
sorters: {
|
||||
nextAiring: function (model) {
|
||||
var nextAiring = model.get('nextAiring');
|
||||
|
||||
if (!nextAiring) {
|
||||
return Number.MAX_VALUE;
|
||||
}
|
||||
|
||||
return Moment(nextAiring).unix();
|
||||
}
|
||||
},
|
||||
|
||||
mode: 'client',
|
||||
|
||||
save: function () {
|
||||
@@ -49,5 +62,7 @@ define(
|
||||
|
||||
var MixedIn = AsPersistedStateCollection.call(Collection);
|
||||
var collection = new MixedIn(SeriesData);
|
||||
collection.initialSort();
|
||||
|
||||
return collection;
|
||||
});
|
||||
|
Reference in New Issue
Block a user