<commit_before>/*global angular:true, CodeMirror:true */
/*jshint browser:true */

(function () {
  'use strict';
  angular.module('codeFriends.project', ['ui.router'])
    .controller('projectController', Project);

  Project.$inject = ['$state', '$stateParams', 'Auth', 'Files', 'ProjectFactory', 'documentFactory', 'SocketFactory'];

  function Project($state, $stateParams, Auth, Files, ProjectFactory, documentFactory, SocketFactory) {
    var vm = this;
    vm.username = Auth.userName;
    vm.files = [];
    vm.currentProjectId = null;
    vm.getProject = getProject;
    vm.escapeBackSlash = escapeBackSlash;

    getProject();

    SocketFactory.onRefreshProject(function () {
      vm.getProject();
    });

    // saves current project id, current project name and files to $scope
    function getProject() {
      return ProjectFactory.getProject($stateParams.projectName)
        .then(function (project) {
          vm.currentProjectId = project.id;
          vm.currentProjectName = project.projectName;
          vm.files = project.files;
          if (typeof $state.params.documentPath === 'undefined') {
            var firstFile;
            angular.forEach(project.files, function (file) {
              if (file.type === 'file') {
                firstFile = file;
                return;
              }
            });
            if (firstFile && firstFile.path) {
              $state.go('document', {
                'projectName': $state.params.projectName,
                'projectId': $state.params.projectId,
                'documentPath': firstFile.path
              });
            }
          }
          return vm.files;
        })
        .catch(function (err) {
          console.log('Could Not Get Project', err);
        });
    }

    function escapeBackSlash(str) {
      str = str.replace(/(\/)/g, '%2F');
      return str;
    }

  }
})();<commit_msg>Edits variables in scope and spacing projects.js<commit_after>/*global angular:true, CodeMirror:true */
/*jshint browser:true */

(function () {
  'use strict';
  angular.module('codeFriends.project', ['ui.router'])
    .controller('projectController', Project);

  Project.$inject = ['$state', '$stateParams', 'Auth', 'Files', 'ProjectFactory', 'documentFactory', 'SocketFactory'];

  function Project($state, $stateParams, Auth, Files, ProjectFactory, documentFactory, SocketFactory) {
    var vm = this;
    vm.username = Auth.userName;
    vm.files = [];
    vm.currentProjectId = null;
    vm.currentProjectName = null;
    vm.getProject = getProject;
    vm.escapeBackSlash = escapeBackSlash;

    getProject();

    SocketFactory.onRefreshProject(function () {
      vm.getProject();
    });

    // saves current project id, current project name and files to $scope
    function getProject() {
      return ProjectFactory.getProject($stateParams.projectName)
        .then(function (project) {
          vm.currentProjectId = project.id;
          vm.currentProjectName = project.projectName;
          vm.files = project.files;
          if (typeof $state.params.documentPath === 'undefined') {
            var firstFile;
            angular.forEach(project.files, function (file) {
              if (file.type === 'file') {
                firstFile = file;
                return;
              }
            });
            if (firstFile && firstFile.path) {
              $state.go('document', {
                'projectName': $state.params.projectName,
                'projectId': $state.params.projectId,
                'documentPath': firstFile.path
              });
            }
          }
          return vm.files;
        })
        .catch(function (err) {
          console.log('Could Not Get Project', err);
        });
    }

    function escapeBackSlash(str) {
      str = str.replace(/(\/)/g, '%2F');
      return str;
    }
  }
})();
{'fraction_non_alphanumeric': 0.13626943005181347, 'fraction_numerical': 0.0005181347150259067, 'mean_word_length': 2.1830173124484746, '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': '2859021', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1043, 'n_words': 222}