From a3ade099647a5b80a54496fcf9b944b28c279521 Mon Sep 17 00:00:00 2001 From: aaraujo666 Date: Thu, 16 Jun 2016 03:00:36 -0400 Subject: [PATCH] New: Missing episodes series filter --- src/UI/Mixins/AsFilteredCollection.js | 17 ++++++++++++++++- src/UI/Series/Index/SeriesIndexLayout.js | 9 ++++++++- src/UI/Series/SeriesCollection.js | 5 +++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/UI/Mixins/AsFilteredCollection.js b/src/UI/Mixins/AsFilteredCollection.js index 3c108c10f..8e7329514 100644 --- a/src/UI/Mixins/AsFilteredCollection.js +++ b/src/UI/Mixins/AsFilteredCollection.js @@ -37,6 +37,21 @@ module.exports = function() { 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; } @@ -72,4 +87,4 @@ module.exports = function() { }); return this; -}; \ No newline at end of file +}; diff --git a/src/UI/Series/Index/SeriesIndexLayout.js b/src/UI/Series/Index/SeriesIndexLayout.js index 31381320a..f5f47b983 100644 --- a/src/UI/Series/Index/SeriesIndexLayout.js +++ b/src/UI/Series/Index/SeriesIndexLayout.js @@ -194,6 +194,13 @@ module.exports = Marionette.Layout.extend({ tooltip : 'Ended Only', icon : 'icon-sonarr-series-ended', callback : this._setFilter + }, + { + key : 'missing', + title : '', + tooltip : 'Missing', + icon : 'icon-sonarr-missing', + callback : this._setFilter } ] }; @@ -344,4 +351,4 @@ module.exports = Marionette.Layout.extend({ this.footer.show(new FooterView({ model : footerModel })); } -}); \ No newline at end of file +}); diff --git a/src/UI/Series/SeriesCollection.js b/src/UI/Series/SeriesCollection.js index 65f4eec73..8dfaf0d99 100644 --- a/src/UI/Series/SeriesCollection.js +++ b/src/UI/Series/SeriesCollection.js @@ -63,6 +63,11 @@ var Collection = PageableCollection.extend({ 'monitored' : [ 'monitored', true + ], + 'missing' : [ + 'percentOfEpisodes', + 100, + 'lt' ] },