<commit_before>'use strict';

// Affiliation controller
angular.module('admin').controller('AffiliationController', ['$scope', '$stateParams', '$location', 'Authentication', 'Affiliations',
  function ($scope, $stateParams, $location, Authentication, Affiliations) {
    $scope.authentication = Authentication;

    // Create new Affiliation
    $scope.create = function (isValid) {
      $scope.error = null;

      if (!isValid) {
        $scope.$broadcast('show-errors-check-validity', 'affiliationForm');
        
        return false;
      }

      // Create new affiliation object
      var affiliation = new Affiliations({
        theAffiliation: this.affiliation, 
        codeAssociated: this.codeAssociated, 
        teamAssociated: this.teamAssociated
      });

      // Redirect after save
      affiliation.$save(function (response) {
        $location.path('/affiliations');

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

    // Remove existing affiliation
    $scope.remove = function (affiliation) {
      if (affiliation) {
        if(confirm("Press OK to confirm deletion.")){
          affiliation.$remove();
          //redirect path after deletion<commit_msg>Changed double quotes to single quotes.<commit_after>'use strict';

// Affiliation controller
angular.module('admin').controller('AffiliationController', ['$scope', '$stateParams', '$location', 'Authentication', 'Affiliations',
  function ($scope, $stateParams, $location, Authentication, Affiliations) {
    $scope.authentication = Authentication;

    // Create new Affiliation
    $scope.create = function (isValid) {
      $scope.error = null;

      if (!isValid) {
        $scope.$broadcast('show-errors-check-validity', 'affiliationForm');
        
        return false;
      }

      // Create new affiliation object
      var affiliation = new Affiliations({
        theAffiliation: this.affiliation, 
        codeAssociated: this.codeAssociated, 
        teamAssociated: this.teamAssociated
      });

      // Redirect after save
      affiliation.$save(function (response) {
        $location.path('/affiliations');

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

    // Remove existing affiliation
    $scope.remove = function (affiliation) {
      if (affiliation) {
        if(confirm('Press OK to confirm deletion.')){
          affiliation.$remove();
          //redirect path after deletion
{'fraction_non_alphanumeric': 0.12575987841945288, 'fraction_numerical': 0.0, 'mean_word_length': 2.7347517730496453, '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': '7489006', 'n_tokens_mistral': 692, 'n_tokens_neox': 669, 'n_words': 160}