<commit_before>(function () {
    'use strict';

    angular
        .module('dpDataSelection')
        .component('dpDataSelectionActiveFilters', {
            bindings: {
                dataset: '@',
                availableFilters: '=',
                textFilters: '=',
                geometryFilter: '<'
            },
            templateUrl: 'modules/data-selection/components/active-filters/active-filters.html',
            controller: DpDataSelectionActiveFilterController,
            controllerAs: 'vm'
        });

    DpDataSelectionActiveFilterController.$inject = ['$scope', 'store', 'ACTIONS'];

    function DpDataSelectionActiveFilterController ($scope, store, ACTIONS) {
        var vm = this;

        const GEOMETRY_FILTER = 'GEOMETRY_FILTER';  // Identification for a geometry filter

        $scope.$watchGroup(['vm.dataset', 'vm.textFilters'], updateFilters, true);

        vm.removeFilter = function (filterSlug) {
            if (filterSlug === GEOMETRY_FILTER) {
                removeGeometryFilter();
            } else {
                const filters = angular.copy(vm.textFilters);

                delete filters[filterSlug];

                applyFilters(filters);
            }
        };

        function updateFilters () {
            vm.formattedActiveFilters = [];

            if (vm.geometryFilter.markers.length > 2) {
                vm.formattedActiveFilters.push({
                    slug: GEOMETRY_FILTER,
                    label: 'Locatie',
                    option: {
                        label: 'ingetekend (' + vm.geometryFilter.description + ')'
                    }
                });
            }

            if (angular.isObject(vm.availableFilters)) {
                const textFilters = vm.availableFilters
                    .filter(filter => angular.isString(vm.textFilters[filter.slug]))
                    .map(filter => {
                        // If there are no options but the filter is active, adding the filtered
                        // value as an option with 0 values available
                        if (filter.numberOfOptions === 0) {
                            filter.numberOfOptions = 1;
                            filter.options = [{
                                id: vm.textFilters[filter.slug],
                                label: vm.textFilters[filter.slug],
                                count: 0
                            }];
                        }
                        return {
                            slug: filter.slug,
                            label: filter.label,
                            option: filter.options.find(opt => opt.id === vm.textFilters[filter.slug])
                        };
                    });
                vm.formattedActiveFilters = vm.formattedActiveFilters.concat(textFilters);
            }
        }

        function removeGeometryFilter () {
            store.dispatch({
                type: ACTIONS.FETCH_DATA_SELECTION,
                payload: {
                    dataset: vm.dataset,
                    resetGeometryFilter: true,
                    page: 1
                }
            });
        }

        function applyFilters (filters) {
            store.dispatch({
                type: ACTIONS.FETCH_DATA_SELECTION,
                payload: {
                    dataset: vm.dataset,
                    filters: filters,
                    page: 1
                }
            });
        }
    }
})();<commit_msg>fixed resetting goemetry filter now keeps other filters intact tg-3876<commit_after>(function () {
    'use strict';

    angular
        .module('dpDataSelection')
        .component('dpDataSelectionActiveFilters', {
            bindings: {
                dataset: '@',
                availableFilters: '=',
                textFilters: '=',
                geometryFilter: '<'
            },
            templateUrl: 'modules/data-selection/components/active-filters/active-filters.html',
            controller: DpDataSelectionActiveFilterController,
            controllerAs: 'vm'
        });

    DpDataSelectionActiveFilterController.$inject = ['$scope', 'store', 'ACTIONS'];

    function DpDataSelectionActiveFilterController ($scope, store, ACTIONS) {
        var vm = this;

        const GEOMETRY_FILTER = 'GEOMETRY_FILTER';  // Identification for a geometry filter

        $scope.$watchGroup(['vm.dataset', 'vm.textFilters'], updateFilters, true);

        vm.removeFilter = function (filterSlug) {
            const filters = angular.copy(vm.textFilters);
            if (filterSlug === GEOMETRY_FILTER) {
                removeGeometryFilter(filters);
            } else {

                delete filters[filterSlug];

                applyFilters(filters);
            }
        };

        function updateFilters () {
            vm.formattedActiveFilters = [];

            if (vm.geometryFilter.markers.length > 2) {
                vm.formattedActiveFilters.push({
                    slug: GEOMETRY_FILTER,
                    label: 'Locatie',
                    option: {
                        label: 'ingetekend (' + vm.geometryFilter.description + ')'
                    }
                });
            }

            if (angular.isObject(vm.availableFilters)) {
                const textFilters = vm.availableFilters
                    .filter(filter => angular.isString(vm.textFilters[filter.slug]))
                    .map(filter => {
                        // If there are no options but the filter is active, adding the filtered
                        // value as an option with 0 values available
                        if (filter.numberOfOptions === 0) {
                            filter.numberOfOptions = 1;
                            filter.options = [{
                                id: vm.textFilters[filter.slug],
                                label: vm.textFilters[filter.slug],
                                count: 0
                            }];
                        }
                        return {
                            slug: filter.slug,
                            label: filter.label,
                            option: filter.options.find(opt => opt.id === vm.textFilters[filter.slug])
                        };
                    });
                vm.formattedActiveFilters = vm.formattedActiveFilters.concat(textFilters);
            }
        }

        function removeGeometryFilter (filters) {
            store.dispatch({
                type: ACTIONS.FETCH_DATA_SELECTION,
                payload: {
                    dataset: vm.dataset,
                    filters,
                    resetGeometryFilter: true,
                    page: 1
                }
            });
        }

        function applyFilters (filters) {
            store.dispatch({
                type: ACTIONS.FETCH_DATA_SELECTION,
                payload: {
                    dataset: vm.dataset,
                    filters,
                    page: 1
                }
            });
        }
    }
})();
{'fraction_non_alphanumeric': 0.0938337801608579, 'fraction_numerical': 0.0025398617186397627, 'mean_word_length': 1.1815943367189905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5454211', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1618, 'n_words': 304}