<commit_before>'use strict';

(function() {

  angular.module('ncsaas')
    .directive('filterList', ['ENV', '$state', filterList]);

  function filterList() {
    return {
      restrict: 'E',
      templateUrl: 'views/directives/filter-list.html',
      replace: true,
      scope: {
        filterController: '='
      },
      link: function ($scope) {
        var controller = $scope.filterController;
        $scope.toggleFilter = toggleFilter;
        $scope.isFilterChosen = isFilterChosen;
        selectAll();
        controller.chosenFilters = [];

        function toggleFilter(filter) {
          if (!isFilterChosen(filter)) {
            controller.chosenFilters.push(filter);
          } else {
            var index = controller.chosenFilters.indexOf(filter);
            controller.chosenFilters.splice(index, 1);
          }

          var values = getFilterValues(filter);
          if (values.length > 0) {
            controller.service.defaultFilter[filter.name] = values;
          } else {
            if (controller.selectAll){
              selectAll();
            } else {
              delete controller.service.defaultFilter[filter.name];
            }
          }

          controller.currentPage = 1;
          controller.service.page = 1;
          controller.getList();
        }

        function selectAll() {
          for (var i = 0; i < controller.searchFilters.length; i++) {
            var filter = controller.searchFilters[i];<commit_msg>Fix filter list default selection (SAAS-500)<commit_after>'use strict';

(function() {

  angular.module('ncsaas')
    .directive('filterList', ['ENV', '$state', filterList]);

  function filterList() {
    return {
      restrict: 'E',
      templateUrl: 'views/directives/filter-list.html',
      replace: true,
      scope: {
        filterController: '='
      },
      link: function ($scope) {
        var controller = $scope.filterController;
        $scope.toggleFilter = toggleFilter;
        $scope.isFilterChosen = isFilterChosen;

        if (controller.selectAll){
          selectAll();
        }

        controller.chosenFilters = [];

        function toggleFilter(filter) {
          if (!isFilterChosen(filter)) {
            controller.chosenFilters.push(filter);
          } else {
            var index = controller.chosenFilters.indexOf(filter);
            controller.chosenFilters.splice(index, 1);
          }

          var values = getFilterValues(filter);
          if (values.length > 0) {
            controller.service.defaultFilter[filter.name] = values;
          } else {
            if (controller.selectAll){
              selectAll();
            } else {
              delete controller.service.defaultFilter[filter.name];
            }
          }

          controller.currentPage = 1;
          controller.service.page = 1;
          controller.getList();
        }

        function selectAll() {
          for (var i = 0; i < controller.searchFilters.length; i++) {
            var filter = controller.searchFilters[i];
{'fraction_non_alphanumeric': 0.11884438608010506, 'fraction_numerical': 0.004267892317793828, 'mean_word_length': 1.9496611810261375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1065548', 'n_tokens_mistral': 817, 'n_tokens_neox': 803, 'n_words': 154}