Fixed: Sorting by timeleft on Activity: Queue

pull/695/head
Mark McDowall 9 years ago
parent 346d7f3cf4
commit ea19020015

@ -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;
}
}
}
});

Loading…
Cancel
Save