1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed: Sorting by timeleft on Activity: Queue

This commit is contained in:
Mark McDowall 2015-07-16 22:57:10 -07:00
parent 346d7f3cf4
commit ea19020015

View File

@ -3,6 +3,7 @@ var PageableCollection = require('backbone.pageable');
var QueueModel = require('./QueueModel');
var FormatHelpers = require('../../Shared/FormatHelpers');
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
var moment = require('moment');
require('../../Mixins/backbone.signalr.mixin');
@ -11,7 +12,8 @@ var QueueCollection = PageableCollection.extend({
model : QueueModel,
state : {
pageSize : 15
pageSize : 15,
sortKey: 'timeleft'
},
mode : 'client',
@ -45,6 +47,18 @@ var QueueCollection = PageableCollection.extend({
return episode.get('title');
}
},
timeleft : {
sortValue : function(model, attr) {
var eta = model.get('estimatedCompletionTime');
if (eta) {
return moment(eta).unix();
}
return Number.MAX_VALUE;
}
}
}
});