<commit_before>app.directive('headerNav', [
  "settings",
  "SessionService",
    "$location",
  function(
    settings,
    SessionService,
     $location
  ) {

    return {
      templateUrl: settings.widgets + 'header/nav.html',
      replace: true,
      link: function(scope, element, attrs) {
       
       //logic
          
        
        scope.isActive = function(route) {
            return route === $location.path();
        }

        SessionService.getSession().success(function(response) {
          
          //Todo, do a get by ID instead of using data from a session
          fetchedUser = response.user;

          if( (fetchedUser._id !== "") && (fetchedUser._id !== null)) {

              scope.first_name = fetchedUser.first_name;
              scope.last_name = fetchedUser.last_name;

            
          } else {
            return false
          }

        });



       
      }
    };
  }
]);<commit_msg>Added function for active nav<commit_after>app.directive('headerNav', [
  "settings",
  "SessionService",
    "$location",
  function(
    settings,
    SessionService,
     $location
  ) {

    return {
      templateUrl: settings.widgets + 'header/nav.html',
      replace: true,
      link: function(scope, element, attrs) {
       
        scope.isActive = function(route) {
            var theLocation = $location.path().split("/")[1];
            //fix if location.path() is root
            if (theLocation === "") {
                theLocation = "/";
            } else {
                theLocation = "/" + theLocation + "/";
            };
            return route === theLocation;
        }

        SessionService.getSession().success(function(response) {
          
          //Todo, do a get by ID instead of using data from a session
          fetchedUser = response.user;

          if( (fetchedUser._id !== "") && (fetchedUser._id !== null)) {

              scope.first_name = fetchedUser.first_name;
              scope.last_name = fetchedUser.last_name;
            
          } else {
            return false
          }

        });

      } //link
    };
  }
]);
{'fraction_non_alphanumeric': 0.1249412869891968, 'fraction_numerical': 0.0004697040864255519, 'mean_word_length': 1.5818181818181818, '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': '5276259', 'n_tokens_mistral': 600, 'n_tokens_neox': 579, 'n_words': 120}