<commit_before>'use strict';

angular.module('searchApp')
  .directive('dateFacetWidget', [ '$rootScope', 'SolrService', function ($rootScope, SolrService) {
    return {
      templateUrl: 'views/date-facet-widget.html',
      restrict: 'E',
      link: function postLink(scope, element, attrs) {

          scope.facets = {};
          scope.selected = [];

          $rootScope.$on('reset-date-facets', function() {
              scope.facets = {};
          });

          $rootScope.$on('start-date-facet-data-ready', function() {
              var a = SolrService.startDateFacets[0].values;
              updateFacets(a);
              updateSelections();
          });
          $rootScope.$on('end-date-facet-data-ready', function() {
              var a = SolrService.endDateFacets[0].values;
              updateFacets(a);
              updateSelections();
          });

          $rootScope.$on('reset-all-filters', function() {
              scope.selected = [];
              updateSelections();
          });

          var updateFacets = function(data) {
              for (var i=0; i < data.length; i++) {
                  var s = parseInt(data[i][0]);
                  var e = parseInt(data[i][0]) + 10;
                  var v = parseInt(data[i][0]) + 9;
                  var d = {
                      'start': s,
                      'end': e,
                      'label': s + ' - ' + v,
                  }
                  if (data[i][1] !== 0 && ! scope.facets[data[i][0]]) {
                      scope.facets[data[i][0]] = d;
                  }
              }
          }
          var updateSelections = function() {
              for (var f in scope.facets) {
                  if (scope.selected.indexOf(parseInt(f)) !== -1) {
                      scope.facets[f].checked = true;
                  } else {
                      scope.facets[f].checked = false;
                  }
              }
          };<commit_msg>remove the date widget filtering; always show all dates<commit_after>'use strict';

angular.module('searchApp')
  .directive('dateFacetWidget', [ '$rootScope', 'SolrService', function ($rootScope, SolrService) {
    return {
      templateUrl: 'views/date-facet-widget.html',
      restrict: 'E',
      link: function postLink(scope, element, attrs) {

          scope.facets = {};
          scope.selected = [];

          $rootScope.$on('reset-date-facets', function() {
              scope.facets = {};
          });

          $rootScope.$on('start-date-facet-data-ready', function() {
              var a = SolrService.startDateFacets[0].values;
              updateFacets(a);
              updateSelections();
          });
          $rootScope.$on('end-date-facet-data-ready', function() {
              var a = SolrService.endDateFacets[0].values;
              updateFacets(a);
              updateSelections();
          });

          $rootScope.$on('reset-all-filters', function() {
              scope.selected = [];
              updateSelections();
          });

          var updateFacets = function(data) {
              for (var i=0; i < data.length; i++) {
                  var s = parseInt(data[i][0]);
                  var e = parseInt(data[i][0]) + 10;
                  var v = parseInt(data[i][0]) + 9;
                  var d = {
                      'start': s,
                      'end': e,
                      'label': s + ' - ' + v,
                  }
                  scope.facets[data[i][0]] = d;
              }
          }
          var updateSelections = function() {
              for (var f in scope.facets) {
                  if (scope.selected.indexOf(parseInt(f)) !== -1) {
                      scope.facets[f].checked = true;
                  } else {
                      scope.facets[f].checked = false;
                  }
              }
          };
{'fraction_non_alphanumeric': 0.14470284237726097, 'fraction_numerical': 0.006459948320413436, 'mean_word_length': 1.3138075313807531, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4321880', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1053, 'n_words': 190}