<commit_before>var app = angular.module('myApp', []); 
app.controller('TaskCtrl', function($scope) {
    $scope.taskList = [{taskText:'Eat Breakfast', done:false , edit : false, filter:false   }];
	$scope.Error = false;
	
	$scope.taskAdd = function() {
		
 		$scope.isDuplicate($scope.taskInput, function(dup){
			
			if(dup) {
				$scope.Error = true;
				$scope.taskInput = "";
				
			}
			else
			{
				$scope.taskList.push({taskText:$scope.taskInput, done:false, edit:false , filter:false });
				$scope.taskInput = "";
			}
		});
	       
		
    };  // end of taskAdd
	
	
	$scope.isDuplicate = function(inp,callback) {
		
		var len = $scope.taskList.length;
		
		var counter = 0;
		var dup = false;
		
		if ( len == 0)
			callback(false);
		else {
        angular.forEach($scope.taskList, function(l) {
			
             l.filter = false;
			 
 			if ( l.taskText.toLowerCase() == inp.toLowerCase() ) {
				
		     
				dup = true;
				
				callback(true);
				
 			}
			else {
				if ( counter == (len-1) && dup == false ) {
					
					callback(false);
				}
			} 
				counter++;
			
			
        });
	}
		
		
		
	}  // end of Is Duplicate
	
	
	$scope.isUpdDuplicate = function(inp,callback) {
		
		var len = $scope.taskList.length;
		
		var counter = 0;
		var dup = false;
		
		if ( len == 0)
			callback(false);
		else {
        angular.forEach($scope.taskList, function(l) {
			
             l.filter = false;
			
 			if ( ( l.taskText.toLowerCase() == inp.taskText.toLowerCase() )  && ( l.$$hashKey != inp.$$hashKey ) ) {
			
				dup = true;
				callback(true);
			   	
 			}
			else {
				if ( counter == (len-1) && dup == false ) {
					
					callback(false);
				}
			} 
				counter++;
			
			
        });
	}
		
		
		
	}  // end of Is update Duplicate
	
	
	$scope.addNew = function(task) {
		
    		
	        var oldList = $scope.taskList;
	        $scope.taskList = [];
			
			  angular.forEach(oldList, function(x) {
				  
			
				  if ( task.taskInput.toLowerCase() == (x.taskText.substr(0,task.taskInput.length)).toLowerCase() ) {
					  
					  x.filter = false;
				  	  $scope.taskList.push(x); 
				  }	 
				  else {
				  	
					  x.filter = true;
					  $scope.taskList.push(x); 
				  }
				  
		
		  });
		  
		} // end of add new task
       
   
    $scope.remove = function() {
        var oldList = $scope.taskList;
        $scope.taskList = [];
        angular.forEach(oldList, function(x) {
			
            if (!x.done) $scope.taskList.push(x);
        });
		$scope.masterSelect = false;
    };  // end of remove
	
	$scope.edit = function() {
		
        var oldList = $scope.taskList;
        $scope.taskList = [];
        angular.forEach(oldList, function(x) {
			
            if (x.done) {  $scope.taskList.push(x);
			x.edit = true;
			x.old  = x.taskText;
			}
			
			if (!x.done) $scope.taskList.push(x);
			
        });
       
    };  // end of edit
	
	$scope.selectAll = function(checkbox) {
		
        var oldList = $scope.taskList;
        $scope.taskList = [];
        angular.forEach(oldList, function(x) {
			
			x.done = checkbox.masterSelect;
			
            $scope.taskList.push(x);
			
        });
       
    };  // end of  update checkboxes
	
	$scope.editUpdate = function(task) {
	    
	   
 	    if ( event.which == 13 ) {
		$scope.isUpdDuplicate(task.x, function(dup){
			
			if(dup) {
				$scope.Error = true;
				$scope.taskInput = "";
				
			}
			else
			{
	  		  task.x.edit     = false;
	  		  task.x.done     = false;
		          $scope.Error    = false;
			}
		});
		$scope.masterSelect = false;
	   
	   }	
			
	   
    }; // end of inline edit.
   
});<commit_msg>Fixed issue with empty update. Task can't be empty<commit_after>var app = angular.module('myApp', []); 
app.controller('TaskCtrl', function($scope) {
    $scope.taskList = [{taskText:'Eat Breakfast', done:false , edit : false, filter:false   }];
	$scope.Error = false;
	
	$scope.taskAdd = function() {
		
 		$scope.isDuplicate($scope.taskInput, function(dup){
			
			if(dup) {
				$scope.Error = true;
				$scope.taskInput = "";
				
			}
			else
			{
				$scope.taskList.push({taskText:$scope.taskInput, done:false, edit:false , filter:false });
				$scope.taskInput = "";
			}
		});
	       
		
    };  // end of taskAdd
	
	
	$scope.isDuplicate = function(inp,callback) {
		
		var len = $scope.taskList.length;
		
		var counter = 0;
		var dup = false;
		
		if ( len == 0)
			callback(false);
		else {
        angular.forEach($scope.taskList, function(l) {
			
             l.filter = false;
			 
 			if ( l.taskText.toLowerCase() == inp.toLowerCase() ) {
				
		     
				dup = true;
				
				callback(true);
				
 			}
			else {
				if ( counter == (len-1) && dup == false ) {
					
					callback(false);
				}
			} 
				counter++;
			
			
        });
	}
		
		
		
	}  // end of Is Duplicate
	
	
	$scope.isUpdDuplicate = function(inp,callback) {
		
		var len = $scope.taskList.length;
		
		var counter = 0;
		var dup = false;
		
		if ( len == 0)
			callback(false);
		else {
        angular.forEach($scope.taskList, function(l) {
			
             l.filter = false;
			
 			if ( ( l.taskText.toLowerCase() == inp.taskText.toLowerCase() )  && ( l.$$hashKey != inp.$$hashKey ) ) {
			
				dup = true;
				callback(true);
			   	
 			}
			else {
				if ( counter == (len-1) && dup == false ) {
					
					callback(false);
				}
			} 
				counter++;
			
			
        });
	}
		
		
		
	}  // end of Is update Duplicate
	
	
	$scope.addNew = function(task) {
		
    		
	        var oldList = $scope.taskList;
	        $scope.taskList = [];
			
			  angular.forEach(oldList, function(x) {
				  
			
				  if ( task.taskInput.toLowerCase() == (x.taskText.substr(0,task.taskInput.length)).toLowerCase() ) {
					  
					  x.filter = false;
				  	  $scope.taskList.push(x); 
				  }	 
				  else {
				  	
					  x.filter = true;
					  $scope.taskList.push(x); 
				  }
				  
		
		  });
		  
		} // end of add new task
       
   
    $scope.remove = function() {
        var oldList = $scope.taskList;
        $scope.taskList = [];
        angular.forEach(oldList, function(x) {
			
            if (!x.done) $scope.taskList.push(x);
        });
		$scope.masterSelect = false;
    };  // end of remove
	
	$scope.edit = function() {
		
        var oldList = $scope.taskList;
        $scope.taskList = [];
        angular.forEach(oldList, function(x) {
			
            if (x.done) {  $scope.taskList.push(x);
			x.edit = true;
			x.old  = x.taskText;
			}
			
			if (!x.done) $scope.taskList.push(x);
			
        });
       
    };  // end of edit
	
	$scope.selectAll = function(checkbox) {
		
        var oldList = $scope.taskList;
        $scope.taskList = [];
        angular.forEach(oldList, function(x) {
			
			x.done = checkbox.masterSelect;
			
            $scope.taskList.push(x);
			
        });
       
    };  // end of  update checkboxes
	
	$scope.editUpdate = function(task) {
	    
	   
 	    if ( event.which == 13 && task.x.taskText != "") {
		$scope.isUpdDuplicate(task.x, function(dup){
			
			if(dup) {
				$scope.Error = true;
				$scope.taskInput = "";
				
			}
			else
			{
	  		  task.x.edit     = false;
	  		  task.x.done     = false;
		          $scope.Error    = false;
			}
		});
		$scope.masterSelect = false;
	   
	   }	
			
	    if (task.x.taskText == "") {
		 
	   	$scope.Error = true;
	   }	
    }; // end of inline edit.
   
});
{'fraction_non_alphanumeric': 0.1533252065556007, 'fraction_numerical': 0.002438033319788704, 'mean_word_length': 1.6705244122965641, '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': '542467', 'n_tokens_mistral': 3239, 'n_tokens_neox': 2522, 'n_words': 431}