<commit_before>'use strict';

// Committees controller
angular.module('committees').controller('CommitteesController', ['$rootScope', '$scope', '$stateParams', '$location', 'Authentication', 'Users', 'Committees', '$q', '$log',
	function($rootScope, $scope, $stateParams, $location, Authentication,Users, Committees, $q, $log) {
		$scope.authentication = Authentication;
		$scope.currentUser = Authentication.user;

		// Create new Committee
		$scope.create = function($scope) {
			// Create new Committee object

			// $scope.chair.id;
			// $scope.name = '<NAME>';

			$log.debug('Chair Id:');
			$log.debug(this.chair_id);

			var committee = new Committees.Committees ({
				name: this.name,
				chair: this.chair_id
			});

			// Redirect after save
			committee.$save(function(response) {
				$location.path('committees/' + response._id);

				// Clear form fields
				//$scope.name = '';
			}, function(errorResponse) { 
				$scope.error = errorResponse.data.message;
			});
		};

		// Remove existing Committee
		$scope.remove = function( committee ) {
			if ( committee ) { committee.$remove();

				for (var i in $scope.committees ) {<commit_msg>Using setChair<commit_after>'use strict';

// Committees controller
angular.module('committees').controller('CommitteesController', ['$rootScope', '$scope', '$stateParams', '$location', 'Authentication', 'Users', 'Committees', '$q', '$log',
	function($rootScope, $scope, $stateParams, $location, Authentication,Users, Committees, $q, $log) {
		$scope.authentication = Authentication;
		$scope.currentUser = Authentication.user;

		// Create new Committee
		$scope.create = function($scope) {
			// Create new Committee object

			// $scope.chair.id;
			// $scope.name = '<NAME>';

			$log.debug('Chair Id:');
			$log.debug(this.chair_id);

			var committee = new Committees.Committees ({
				name: this.name,
				//chair: this.chair_id
			});

			// Redirect after save
			committee.$save(function(response) {
				$location.path('committees/' + response._id);

			$scope.setChair();
				
				// Clear form fields
				//$scope.name = '';
			}, function(errorResponse) { 
				$scope.error = errorResponse.data.message;
			});
		};

		// Remove existing Committee
		$scope.remove = function( committee ) {
			if ( committee ) { committee.$remove();

				for (var i in $scope.committees ) {
{'fraction_non_alphanumeric': 0.1703672075149445, 'fraction_numerical': 0.0, 'mean_word_length': 3.7048192771084336, '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': '17277', 'n_tokens_mistral': 845, 'n_tokens_neox': 704, 'n_words': 154}