Fixed: Episode Progress custom filtering on series list page

This commit is contained in:
Mark McDowall 2019-08-15 18:12:19 -07:00
parent 31be74e6d3
commit 78ee6afbae
1 changed files with 22 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import moment from 'moment';
import { createAction } from 'redux-actions';
import sortByName from 'Utilities/Array/sortByName';
import { filterBuilderTypes, filterBuilderValueTypes, sortDirections } from 'Helpers/Props';
import { filterBuilderTypes, filterBuilderValueTypes, filterTypePredicates, sortDirections } from 'Helpers/Props';
import createSetTableOptionReducer from './Creators/Reducers/createSetTableOptionReducer';
import createSetClientSideCollectionSortReducer from './Creators/Reducers/createSetClientSideCollectionSortReducer';
import createSetClientSideCollectionFilterReducer from './Creators/Reducers/createSetClientSideCollectionFilterReducer';
@ -246,7 +246,27 @@ export const defaultState = {
selectedFilterKey: 'all',
filters,
filterPredicates,
filterPredicates: {
...filterPredicates,
episodeProgress: function(item, filterValue, type) {
const { statistics = {} } = item;
const {
episodeCount = 0,
episodeFileCount
} = statistics;
const progress = episodeCount ?
episodeFileCount / episodeCount * 100 :
100;
const predicate = filterTypePredicates[type];
return predicate(progress, filterValue);
}
},
filterBuilderProps: [
{