<commit_before>function EnvironmentalCtrl($scope, searchModelService, EnvironmentalVariable, EnvironmentalValue, MinAndMax) {
    var linkModel = function() {
        // Get a reference to the environmental search params from the model
        $scope.environmentalData = searchModelService.getModel().getEnvironmentalData();
        if ($scope.environmentalData.selectedVariables.length == 0) {
            $scope.environmentalData.selectedVariables.push({'vals': ['', ''], 'selectedFilter': $scope.environmentalData.selectedFilter, 'variables': []});
            $scope.environmentalData.badgeValue = 1;
        }
            
    };
    $scope.$on('searchModelReset', linkModel); // When model is reset, update our model
    linkModel();
    
    $scope.categoryChanged = function(variable) {
        variable.variables = EnvironmentalVariable.query({category: variable.selectedCategory.id});    
    };
    
    $scope.addVariable = function() {
        $scope.environmentalData.selectedVariables.push({'vals': ['', ''], 'selectedFilter': $scope.environmentalData.selectedFilter, 'variables': []});
        $scope.environmentalData.badgeValue += 1;
    };
    
    $scope.removeVariable = function(variable) {
        var index = $scope.environmentalData.selectedVariables.indexOf(variable);
        $scope.environmentalData.selectedVariables.splice(index, 1);
        $scope.environmentalData.badgeValue -= 1;
    };

    $scope.variableChanged = function(variable) {
        if(variable.selectedVariable != null && $scope.environmentalData.badgeValue == 0) {
            $scope.environmentalData.badgeValue += 1;
        } 

        variable.EnvironmentalForm.$setPristine();
        $scope.values = MinAndMax.query({query: {environmental_id: variable.selectedVariable.id}});
        $scope.filterChanged(variable);
    };
    
    $scope.filterChanged = function(variable) {
        if (variable.EnvironmentalForm.$dirty && variable.selectedFilter.operator != 'all') return;
        selected_variable = $scope.environmentalData.selectedVariables.filter(function(env_var) {
            return env_var.selectedVariable.id == variable.selectedVariable.id;
        });
        if (selected_variable.length == 1) {<commit_msg>Fixing environmental search badge value<commit_after>function EnvironmentalCtrl($scope, searchModelService, EnvironmentalVariable, EnvironmentalValue, MinAndMax) {
    var linkModel = function() {
        // Get a reference to the environmental search params from the model
        $scope.environmentalData = searchModelService.getModel().getEnvironmentalData();
        if ($scope.environmentalData.selectedVariables.length == 0) {
            $scope.environmentalData.selectedVariables.push({'vals': ['', ''], 'selectedFilter': $scope.environmentalData.selectedFilter, 'variables': []});
        }
            
    };
    $scope.$on('searchModelReset', linkModel); // When model is reset, update our model
    linkModel();
    
    $scope.categoryChanged = function(variable) {
        variable.variables = EnvironmentalVariable.query({category: variable.selectedCategory.id});    
    };
    
    $scope.addVariable = function() {
        $scope.environmentalData.selectedVariables.push({'vals': ['', ''], 'selectedFilter': $scope.environmentalData.selectedFilter, 'variables': []});
    };
    
    $scope.removeVariable = function(variable) {
        var index = $scope.environmentalData.selectedVariables.indexOf(variable);
        $scope.environmentalData.selectedVariables.splice(index, 1);
        $scope.environmentalData.badgeValue -= 1;
    };

    $scope.variableChanged = function(variable) {
        if(variable.selectedVariable != null) {
            $scope.environmentalData.badgeValue += 1;
        } 

        variable.EnvironmentalForm.$setPristine();
        $scope.values = MinAndMax.query({query: {environmental_id: variable.selectedVariable.id}});
        $scope.filterChanged(variable);
    };
    
    $scope.filterChanged = function(variable) {
        if (variable.EnvironmentalForm.$dirty && variable.selectedFilter.operator != 'all') return;
        selected_variable = $scope.environmentalData.selectedVariables.filter(function(env_var) {
            return env_var.selectedVariable.id == variable.selectedVariable.id;
        });
        if (selected_variable.length == 1) {
{'fraction_non_alphanumeric': 0.12739441495499654, 'fraction_numerical': 0.003000230786983614, 'mean_word_length': 3.4726522187822497, 'pattern_counts': {'":': 0, '<': 3, '<?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': '674085', 'n_tokens_mistral': 1129, 'n_tokens_neox': 1108, 'n_words': 182}