<commit_before>define(['../module'], function(controllers){
	'use strict';
	controllers.controller('ViewStudentCtrl', ['$scope', '$log', '$state', '$stateParams', 'StudentSvc',
		function($scope, $log, $state, $stateParams, StudentSvc) {
			$scope.currentStudent = {};

			if (StudentSvc.current && StudentSvc.viewing) {
				$scope.currentStudent = StudentSvc.current;
			} else if ($stateParams.id) {
				StudentSvc.read($stateParams.id, null, true).then(function(student) {
					$scope.currentStudent = student;
				});
			}

			if (StudentSvc.current && StudentSvc.viewing) {
				$scope.currentStudent = StudentSvc.current;
			}

			$scope.backToHome = function() {
				StudentSvc.reset();
				$state.go('admin.students.home');
			};

			$scope.showEContact1 = function() {
				return $scope.currentStudent.emergencyContacts && 
						$scope.currentStudent.emergencyContacts != null && 
						$scope.currentStudent.emergencyContacts.length > 0;
			};

			$scope.showEContact2 = function() {
				return $scope.currentStudent.emergencyContacts && 
						$scope.currentStudent.emergencyContacts != null && 
						$scope.currentStudent.emergencyContacts.length > 1;
			};

			$scope.editStudent = function() {
				StudentSvc.reset();
				$state.go('admin.students.edit', {id: $stateParams.id});
			};

            $scope.remove = function() {
                $scope.showRemoveConfirm = true;
            };

            $scope.confirmRemove = function(remove) {
                if(remove) {
                    $log.log('need to remove');
                    $scope.showRemoveConfirm = false;
                } else {
                    $scope.showRemoveConfirm = false;
                }
            };

            $scope.showRemoveConfirm = false;
	}]);
});<commit_msg>added remove support on view page for individual student<commit_after>define(['../module'], function(controllers){
	'use strict';
	controllers.controller('ViewStudentCtrl', ['$scope', '$log', '$state', '$stateParams', 'StudentSvc',
		function($scope, $log, $state, $stateParams, StudentSvc) {
			$scope.currentStudent = {};

			if (StudentSvc.current && StudentSvc.viewing) {
				$scope.currentStudent = StudentSvc.current;
			} else if ($stateParams.id) {
				StudentSvc.read($stateParams.id, null, true).then(function(student) {
					$scope.currentStudent = student;
				});
			}

			if (StudentSvc.current && StudentSvc.viewing) {
				$scope.currentStudent = StudentSvc.current;
			}

			$scope.backToHome = function() {
				StudentSvc.reset();
				$state.go('admin.students.home');
			};

			$scope.showEContact1 = function() {
				return $scope.currentStudent.emergencyContacts && 
						$scope.currentStudent.emergencyContacts != null && 
						$scope.currentStudent.emergencyContacts.length > 0;
			};

			$scope.showEContact2 = function() {
				return $scope.currentStudent.emergencyContacts && 
						$scope.currentStudent.emergencyContacts != null && 
						$scope.currentStudent.emergencyContacts.length > 1;
			};

			$scope.editStudent = function() {
				StudentSvc.reset();
				$state.go('admin.students.edit', {id: $stateParams.id});
			};

            $scope.remove = function() {
                $scope.showRemoveConfirm = true;
            };

            $scope.confirmRemove = function(remove) {
                if(remove) {
                    $log.log('Removing selected student...');

                    $log.log(' |_ Removing student: ' + $scope.currentStudent.firstName + ' ' + $scope.currentStudent.lastName + ' ' + $scope.currentStudent._id);
                    removeStudentData($scope.currentStudent);

                    $scope.showRemoveConfirm = false;
                } else {
                    $scope.showRemoveConfirm = false;
                }
            };

            $scope.showRemoveConfirm = false;

            function removeStudentData(student) {
                //Remove Student
                StudentSvc.read(student._id, null, true).then(function() {
                    StudentSvc.remove().then(function() {
                        StudentSvc.reset();
                        $scope.backToHome();
                    });
                });
            }
	}]);
});
{'fraction_non_alphanumeric': 0.14336832061068702, 'fraction_numerical': 0.0019083969465648854, 'mean_word_length': 2.349041533546326, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '512979', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1179, 'n_words': 179}