<commit_before>'use strict';

// Huts controller
angular.module('huts').controller('HutsController', ['$scope', '$stateParams', '$location', 'Authentication', 'Huts', 'MyHuts', 'Servers', 'Socket',
  function($scope, $stateParams, $location, Authentication, Huts, MyHuts, Servers, Socket) {
    $scope.authentication = Authentication;
		$scope.servers = Servers.query();

    // Create new Hut
    $scope.create = function() {
      // Create new Hut object
      var hut = new Huts({
        name: this.name,
        product: this.product,
				server: this.server

      });

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

        // Clear form fields
        $scope.name = '';
        $scope.product = '';
        $scope.server = '';

      }, function(errorResponse) {
        $scope.error = errorResponse.data.message;
      });
    };

    // Remove existing Hut
    $scope.remove = function(hut) {

      if (hut) {
        hut.$remove();

        for (var i in $scope.huts) {
          if ($scope.huts[i] === hut) {
            $scope.huts.splice(i, 1);
          }
        }
      } else {
        $scope.hut.$remove(function() {
          $location.path('huts');
        });
      }<commit_msg>Redirect to dashboard after deleting huts<commit_after>'use strict';

// Huts controller
angular.module('huts').controller('HutsController', ['$scope', '$stateParams', '$location', 'Authentication', 'Huts', 'MyHuts', 'Servers', 'Socket',
  function($scope, $stateParams, $location, Authentication, Huts, MyHuts, Servers, Socket) {
    $scope.authentication = Authentication;
		$scope.servers = Servers.query();

    // Create new Hut
    $scope.create = function() {
      // Create new Hut object
      var hut = new Huts({
        name: this.name,
        product: this.product,
				server: this.server

      });

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

        // Clear form fields
        $scope.name = '';
        $scope.product = '';
        $scope.server = '';

      }, function(errorResponse) {
        $scope.error = errorResponse.data.message;
      });
    };

    // Remove existing Hut
    $scope.remove = function(hut) {

      if (hut) {
        hut.$remove();

        for (var i in $scope.huts) {
          if ($scope.huts[i] === hut) {
            $scope.huts.splice(i, 1);
          }
        }
      } else {
        $scope.hut.$remove(function() {
          $location.path('dashboard');
        });
      }
{'fraction_non_alphanumeric': 0.16233009708737864, 'fraction_numerical': 0.0007766990291262136, 'mean_word_length': 2.156862745098039, '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': '5393013', 'n_tokens_mistral': 810, 'n_tokens_neox': 773, 'n_words': 165}