Fixed series filter 'missing' since percentOfEpisodes isn't always set.

This commit is contained in:
Taloth Saldono 2016-06-19 00:28:01 +02:00
parent b3eee50892
commit 2fa0729158
2 changed files with 8 additions and 19 deletions

View File

@ -31,27 +31,16 @@ module.exports = function() {
self.shadowCollection = originalMakeFullCollection.call(this, models, options);
var filterModel = function(model) {
if (!self.state.filterKey || !self.state.filterValue) {
if (_.isFunction(self.state.filterType)) {
return self.state.filterType(model);
}
if (!self.state.filterKey) {
return true;
}
else if (self.state.filterType === 'contains') {
return model.get(self.state.filterKey).toLowerCase().indexOf(self.state.filterValue.toLowerCase()) > -1;
}
else if (self.state.filterType === 'lt') {
return model.get(self.state.filterKey) < self.state.filterValue;
}
else if (self.state.filterType === 'gt') {
return model.get(self.state.filterKey) > self.state.filterValue;
}
else if (self.state.filterType === 'le') {
return model.get(self.state.filterKey) <= self.state.filterValue;
}
else if (self.state.filterType === 'ge') {
return model.get(self.state.filterKey) >= self.state.filterValue;
}
else if (self.state.filterType === 'ne') {
return model.get(self.state.filterKey) !== self.state.filterValue;
}
else {
return model.get(self.state.filterKey) === self.state.filterValue;
}

View File

@ -65,9 +65,9 @@ var Collection = PageableCollection.extend({
true
],
'missing' : [
'percentOfEpisodes',
100,
'lt'
null,
null,
function(model) { return model.get('episodeCount') !== model.get('episodeFileCount'); }
]
},