<commit_before>'use strict';

// Members controller
angular.module('members').controller('MembersController', ['$scope', '$stateParams', '$location', 'Authentication', 'Members', 'Participants',
	function($scope, $stateParams, $location, Authentication, Members, Participants) {
		$scope.authentication = Authentication;

		// Create new Member
		$scope.create = function() {
			
			var clearFields = function(Participant) {
				$scope.member.firstName = '';
				$scope.member.lastName = '';
				$scope.member.phone = '';
				$scope.member.email = '';
				$scope.member.identity = '';
				$scope.member.affiliation = '';
				$scope.member.address = '';
				$scope.member.shirtSize = '';
				$scope.member.shirtReceived = '';
				$scope.member.talent = '';
				$scope.member.placeOfWorship = '';
				$scope.member.recruitment = '';
				$scope.member.communityNetworks[0] = '';
				$scope.member.communityNetworks[1] = '';
				$scope.member.communityNetworks[2] = '';
				$scope.member.extraGroups[0] = '';
				$scope.member.extraGroups[1] = '';
				$scope.member.extraGroups[2] = '';
				$scope.member.otherNetworks[0] = '';
				$scope.member.otherNetworks[1] = '';
				$scope.member.otherNetworks[2] = '';
			};

			// Create new Member
			var member = $scope.member;
			
			if(member && member._id) {
				member.$update(function(response) {
					$location.path('members/' + response._id);
					clearFields(response);
				}, function(errorResponse) {
				    $scope.error = errorResponse.data.message;
				});
				
			} else {                 
				// Redirect after save
				member.$save(function(response) {
					clearFields(response);
				}, function(errorResponse) {
					$scope.error = errorResponse.data.message;
				});
				
			} 
		};

		// Remove existing Member
		$scope.remove = function(member) {
			if ( member ) { 
				member.$remove();

				for (var i in $scope.members) {
					if ($scope .members [i] === member) {
						$scope.members.splice(i, 1);
					}
				}
			} else {<commit_msg>Readded redirect after new member is saved<commit_after>'use strict';

// Members controller
angular.module('members').controller('MembersController', ['$scope', '$stateParams', '$location', 'Authentication', 'Members', 'Participants',
	function($scope, $stateParams, $location, Authentication, Members, Participants) {
		$scope.authentication = Authentication;

		// Create new Member
		$scope.create = function() {
			
			var clearFields = function(Participant) {
				$scope.member.firstName = '';
				$scope.member.lastName = '';
				$scope.member.phone = '';
				$scope.member.email = '';
				$scope.member.identity = '';
				$scope.member.affiliation = '';
				$scope.member.address = '';
				$scope.member.shirtSize = '';
				$scope.member.shirtReceived = '';
				$scope.member.talent = '';
				$scope.member.placeOfWorship = '';
				$scope.member.recruitment = '';
				$scope.member.communityNetworks[0] = '';
				$scope.member.communityNetworks[1] = '';
				$scope.member.communityNetworks[2] = '';
				$scope.member.extraGroups[0] = '';
				$scope.member.extraGroups[1] = '';
				$scope.member.extraGroups[2] = '';
				$scope.member.otherNetworks[0] = '';
				$scope.member.otherNetworks[1] = '';
				$scope.member.otherNetworks[2] = '';
			};

			// Create new Member
			var member = $scope.member;
			
			if(member && member._id) {
				member.$update(function(response) {
					$location.path('members/' + response._id);
					clearFields(response);
				}, function(errorResponse) {
				    $scope.error = errorResponse.data.message;
				});
				
			} else {                 
				// Redirect after save
				member.$save(function(response) {
					$location.path('members/' + response._id);
					clearFields(response);
				}, function(errorResponse) {
					$scope.error = errorResponse.data.message;
				});
				
			} 
		};

		// Remove existing Member
		$scope.remove = function(member) {
			if ( member ) { 
				member.$remove();

				for (var i in $scope.members) {
					if ($scope .members [i] === member) {
						$scope.members.splice(i, 1);
					}
				}
			} else {
{'fraction_non_alphanumeric': 0.17455258641823976, 'fraction_numerical': 0.004903162539838196, 'mean_word_length': 3.0, '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': '5011440', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1239, 'n_words': 194}