Fixed: Episode Progress custom filtering on series list page
This commit is contained in:
parent
31be74e6d3
commit
78ee6afbae
|
@ -1,7 +1,7 @@
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { createAction } from 'redux-actions';
|
import { createAction } from 'redux-actions';
|
||||||
import sortByName from 'Utilities/Array/sortByName';
|
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 createSetTableOptionReducer from './Creators/Reducers/createSetTableOptionReducer';
|
||||||
import createSetClientSideCollectionSortReducer from './Creators/Reducers/createSetClientSideCollectionSortReducer';
|
import createSetClientSideCollectionSortReducer from './Creators/Reducers/createSetClientSideCollectionSortReducer';
|
||||||
import createSetClientSideCollectionFilterReducer from './Creators/Reducers/createSetClientSideCollectionFilterReducer';
|
import createSetClientSideCollectionFilterReducer from './Creators/Reducers/createSetClientSideCollectionFilterReducer';
|
||||||
|
@ -246,7 +246,27 @@ export const defaultState = {
|
||||||
selectedFilterKey: 'all',
|
selectedFilterKey: 'all',
|
||||||
|
|
||||||
filters,
|
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: [
|
filterBuilderProps: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue