<commit_before>/**
 * HomeController
 **/

angular.module('controllers')
  .controller('homeController',
    function HomeController($scope, $state, Restangular, $location, $mdSidenav, $rootScope, clientCacheService, $mdSidenav, menu) {
      $scope.state = $state;

      var vm = this;

      vm.isOpen = isOpen;
      vm.toggleOpen = toggleOpen;
      vm.autoFocusContent = false;

      vm.status = {
        isFirstOpen: true,
        isFirstDisabled: false
      };



      $rootScope.isAuthenticated = clientCacheService.isAuthenticated();
      if (!clientCacheService.isAuthenticated()) {
        if ($location.path() != '/login' && $location.path() != '/register') {
          $location.path('/login');
        }
      } else {
        Restangular.all('organizations').getList().then(function(data) {
          $scope.organizations = data;
          menu.organization = data[0];
          menu.orgsToMenu(data);
          $scope.menu = menu;
          $state.go('spaces', {
            organizationId: data[0].metadata.guid
          })
        }, function(response) {
          clientCacheService.clear;
          $location.path('/login');
          $rootScope.isAuthenticated = false;
        }).then(function() {
          /*$scope.$watch('organization', function(organization) {
            $state.go('app-spaces', {
              organizationId: organization.metadata.guid
            }, {
              reload: true
            });
          })*/
        });
      }



      $scope.logout = function() {
        $rootScope.isAuthenticated = false;
        clientCacheService.logout();
        $state.go('login', {}, {
          reload: true
        });
      };

      $scope.openMenu = function() {
        $mdSidenav('left').toggle();
      };

      $scope.updateTitle = function(name) {
        console.debug('homeController: '+name);
        $scope.appTitle = name;
      }

      function isOpen(section) {
        return menu.isSectionSelected(section);
      }
<commit_msg>bugfix in homecontroller for menu<commit_after>/**
 * HomeController
 **/

angular.module('controllers')
  .controller('homeController',
    function HomeController($scope, $state, Restangular, $location, $mdSidenav, $rootScope, clientCacheService, $mdSidenav, menu) {
      $scope.state = $state;

      var vm = this;

      vm.isOpen = isOpen;
      vm.toggleOpen = toggleOpen;
      vm.autoFocusContent = false;

      vm.status = {
        isFirstOpen: true,
        isFirstDisabled: false
      };



      $rootScope.isAuthenticated = clientCacheService.isAuthenticated();
      if (!clientCacheService.isAuthenticated()) {
        if ($location.path() != '/login' && $location.path() != '/register') {
          $location.path('/login');
        }
      } else {
        Restangular.all('organizations').getList().then(function(data) {
          $scope.organizations = data;
          menu.organization = data[0];
          menu.orgsToMenu(data);
          $state.go('spaces', {
            organizationId: data[0].metadata.guid
          })
        }, function(response) {
          clientCacheService.clear;
          $location.path('/login');
          $rootScope.isAuthenticated = false;
        }).then(function() {
          $scope.menu = menu;
        });

      }

      $scope.$watch('menu', function() {
        console.log("watch!!!");
        $scope.menu = menu;
      });


      $scope.logout = function() {
        $rootScope.isAuthenticated = false;
        clientCacheService.logout();
        $state.go('login', {}, {
          reload: true
        });
      };

      $scope.openMenu = function() {
        $mdSidenav('left').toggle();
      };

      $scope.updateTitle = function(name) {
        console.debug('homeController: '+name);
        $scope.appTitle = name;
      }

      function isOpen(section) {
        return menu.isSectionSelected(section);
      }

{'fraction_non_alphanumeric': 0.14740626605033386, 'fraction_numerical': 0.001027221366204417, 'mean_word_length': 2.0937251787132647, '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': '5627355', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1090, 'n_words': 174}