diff --git a/frontend/app/components/query/query.service.js b/frontend/app/components/query/query.service.js index 7e925fd98b..7798944191 100644 --- a/frontend/app/components/query/query.service.js +++ b/frontend/app/components/query/query.service.js @@ -334,9 +334,9 @@ function QueryConstructorService(Filter, Sortation, UrlParamsHelper, INITIALLY_S }, getRemainingFilters: function() { - var activeFilters = _.indexBy(this.getActiveFilters(), function(f) { return f.modelName }); - return _.filter(this.availableWorkPackageFilters, function(filter) { - return !activeFilters[filter.modelName]; + var activeFilters = _.indexBy(this.getActiveFilters(), function(f) { return f.name }); + return _.pick(this.availableWorkPackageFilters, function(filter, key) { + return !activeFilters[key]; }); }, diff --git a/frontend/app/work_packages/directives/query-filters-directive.js b/frontend/app/work_packages/directives/query-filters-directive.js index c792cd1537..562ad84ede 100644 --- a/frontend/app/work_packages/directives/query-filters-directive.js +++ b/frontend/app/work_packages/directives/query-filters-directive.js @@ -42,7 +42,7 @@ module.exports = function($timeout, FiltersHelper, I18n, ADD_FILTER_SELECT_INDEX scope.$watch('filterToBeAdded', function(filter) { if (filter) { - scope.query.addFilter(filter.value); + scope.query.addFilter(filter.key); scope.filterToBeAdded = undefined; var index = scope.query.getActiveFilters().length; updateFilterFocus(index); @@ -66,8 +66,9 @@ module.exports = function($timeout, FiltersHelper, I18n, ADD_FILTER_SELECT_INDEX }; function updateRemainingFilters() { - var remainingFilters = _.map(scope.query.getRemainingFilters(), function(filter) { + var remainingFilters = _.map(scope.query.getRemainingFilters(), function(filter, key) { return { + key: key, value: filter.modelName, name: FiltersHelper.localisedFilterName(filter) };