<commit_before>(function() {
  'use strict';

  angular
    .module('app')
    .controller('CreateController', CreateController);

    CreateController.$inject = ['$scope','$rootScope','$timeout','$location','scenarioService','metaService'];

    function CreateController($scope,$rootScope,$timeout,$location,scenarioService,metaService) {

      $rootScope.title = 'Create new scenario | Leplanner beta';

      $scope.createScenario = function(scenario){

        $scope.saving_in_progress = true;

        if(typeof scenario.name == 'undefined' || scenario.name === '' || scenario.name.length <= 2){
          $scope.errorMessage = 'Scenario name has to be atleast 3 chars long!';
          $timeout(function() { $scope.errorMessage = null; }, 2000);
          return;
        }

        if(typeof scenario.description == 'undefined' || scenario.description === '' || scenario.description.length <= 2){
          $scope.errorMessage = 'Scenario description has to be atleast 3 chars long!';
          $timeout(function() { $scope.errorMessage = null; }, 2000);
          return;
        }

        var params = {
          user: {
            _id: $rootScope.user._id
          },
          scenario: scenario
        };

        $scope.saving = true;

        scenarioService.createScenario(params)
          .then(function(data) {

            $scope.saving_in_progress = undefined;

            if(data.scenario){

              $scope.errorMessage = null;
<commit_msg>fixed empty form submission causing disabled save button<commit_after>(function() {
  'use strict';

  angular
    .module('app')
    .controller('CreateController', CreateController);

    CreateController.$inject = ['$scope','$rootScope','$timeout','$location','scenarioService','metaService'];

    function CreateController($scope,$rootScope,$timeout,$location,scenarioService,metaService) {

      $rootScope.title = 'Create new scenario | Leplanner beta';

      $scope.createScenario = function(scenario){

        $scope.saving_in_progress = true;

        if(!scenario || typeof scenario.name == 'undefined' || scenario.name === '' || scenario.name.length <= 2){
          $scope.errorMessage = 'Scenario name has to be atleast 3 chars long!';
          $scope.saving_in_progress = undefined;
          $timeout(function() { $scope.errorMessage = null; }, 2000);
          return;
        }

        if(typeof scenario.description == 'undefined' || scenario.description === '' || scenario.description.length <= 2){
          $scope.errorMessage = 'Scenario description has to be atleast 3 chars long!';
          $scope.saving_in_progress = undefined;
          $timeout(function() { $scope.errorMessage = null; }, 2000);
          return;
        }

        var params = {
          user: {
            _id: $rootScope.user._id
          },
          scenario: scenario
        };

        $scope.saving = true;

        scenarioService.createScenario(params)
          .then(function(data) {

            $scope.saving_in_progress = undefined;

            if(data.scenario){

              $scope.errorMessage = null;

{'fraction_non_alphanumeric': 0.13425627817128138, 'fraction_numerical': 0.0077269800386349004, 'mean_word_length': 2.6127906976744186, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7366675', 'n_tokens_mistral': 867, 'n_tokens_neox': 802, 'n_words': 170}