<commit_before>'use strict';

(function() {
  angular.module('fileListController', ['fileListService']).

  controller('FileListController', ['$scope', '$routeSegment', 'FileList', 'Tag', function($scope, $routeSegment, FileList, Tag) {
    $scope.$routeSegment = $routeSegment;
    $scope.file_list = FileList;
    $scope.remove_file = FileList.remove.bind(FileList);
    $scope.remove_tag = function(id, tag) {
      Tag.remove(id, tag);
    };

    // Ensure the "selected" list is empty if the file list changes
    $scope.watch('file_list', function() {
      $scope.$apply(function() {
        $scope.selected = [];
        $scope.all_selected = false;
      });
    });

    $scope.selected = [];
    $scope.all_selected = false;

    $scope.select_all = function() {
      if (!$scope.all_selected) {
        $scope.selected = FileList.files.map(function(file) {
          return file.id;
        });
        $scope.all_selected = true;
      } else {
        $scope.selected = [];
        $scope.all_selected = false;
      }
    };
    $scope.toggle_file = function(uuid) {
      var index = $scope.selected.indexOf(uuid);
      // remove from selection
      if (index > -1) {
        $scope.selected.splice(index, 1);
      } else {
        $scope.selected.push(uuid);
      }

      $scope.all_selected = !($scope.selected.length < FileList.files.length);
    };
<commit_msg>File list: remove buggy $scope.watch<commit_after>'use strict';

(function() {
  angular.module('fileListController', ['fileListService']).

  controller('FileListController', ['$scope', '$routeSegment', 'FileList', 'Tag', function($scope, $routeSegment, FileList, Tag) {
    $scope.$routeSegment = $routeSegment;
    $scope.file_list = FileList;
    $scope.remove_file = FileList.remove.bind(FileList);
    $scope.remove_tag = function(id, tag) {
      Tag.remove(id, tag);
    };

    $scope.selected = [];
    $scope.all_selected = false;

    $scope.select_all = function() {
      if (!$scope.all_selected) {
        $scope.selected = FileList.files.map(function(file) {
          return file.id;
        });
        $scope.all_selected = true;
      } else {
        $scope.selected = [];
        $scope.all_selected = false;
      }
    };
    $scope.toggle_file = function(uuid) {
      var index = $scope.selected.indexOf(uuid);
      // remove from selection
      if (index > -1) {
        $scope.selected.splice(index, 1);
      } else {
        $scope.selected.push(uuid);
      }

      $scope.all_selected = !($scope.selected.length < FileList.files.length);
    };

{'fraction_non_alphanumeric': 0.15998442973919813, 'fraction_numerical': 0.001557026080186843, 'mean_word_length': 2.6714285714285713, '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': '2255101', 'n_tokens_mistral': 804, 'n_tokens_neox': 795, 'n_words': 141}