Select query filter keys correctly (#4337)

Fixes a regression from https://github.com/opf/openproject/pull/4333
pull/4339/head
Oliver Günther 9 years ago
parent 386d4b53e7
commit b70f102060
  1. 6
      frontend/app/components/query/query.service.js
  2. 5
      frontend/app/work_packages/directives/query-filters-directive.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];
});
},

@ -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)
};

Loading…
Cancel
Save