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

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); self.shadowCollection = originalMakeFullCollection.call(this, models, options);
var filterModel = function(model) { 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; return true;
} }
else if (self.state.filterType === 'contains') { else if (self.state.filterType === 'contains') {
return model.get(self.state.filterKey).toLowerCase().indexOf(self.state.filterValue.toLowerCase()) > -1; 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 { else {
return model.get(self.state.filterKey) === self.state.filterValue; return model.get(self.state.filterKey) === self.state.filterValue;
} }

View File

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