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

  angular.module('dimApp')
    .directive('dimStats', Stats);

  Stats.$inject = [];

  function Stats() {
    return {
      controller: StatsCtrl,
      controllerAs: 'vm',
      bindToController: true,
      scope: {
        stats: '='
      },
      template: [
        '<div class="stat-bars">',
        '  <div class="stat" title="{{vm.formatTooltip(\'STAT_INTELLECT\')}}">',
        '    <img src="images/intellect.png">',
        '    <div class="bar" ng-repeat="n in vm.stats.STAT_INTELLECT.tiers track by $index">',
        '      <div class="progress" ng-class="{complete: (n / 60) === 1 }" dim-percent-width="n / 60"></div>',
        '    </div>',
        '  </div>',
        '  <div class="stat" title="{{vm.formatTooltip(\'STAT_DISCIPLINE\')}}">',
        '    <img src="images/discipline.png">',
        '    <div class="bar" ng-repeat="n in vm.stats.STAT_DISCIPLINE.tiers track by $index">',
        '      <div class="progress" ng-class="{complete: (n / 60) === 1 }" dim-percent-width="n / 60"></div>',
        '    </div>',
        '  </div>',
        '  <div class="stat" title="{{vm.formatTooltip(\'STAT_STRENGTH\')}}">',
        '    <img src="images/strength.png">',
        '    <div class="bar" ng-repeat="n in vm.stats.STAT_STRENGTH.tiers track by $index">',
        '      <div class="progress" ng-class="{complete: (n / 60) === 1 }" dim-percent-width="n / 60"></div>',
        '    </div>',
        '  </div>',
        '</div>'
      ].join('')
    };
  }

  StatsCtrl.$inject = ['$translate'];

  function StatsCtrl($translate) {
    var vm = this;

    _.each(vm.stats, function(stat) {
      stat.normalized = stat.value > 300 ? 300 : stat.value;
      stat.tier = Math.floor(stat.normalized / 60);
      stat.tiers = [];
      stat.remaining = stat.value;
      for (var t = 0; t < 5; t++) {
        stat.remaining -= stat.tiers[t] = stat.remaining > 60 ? 60 : stat.remaining;
      }
      stat.percentage = (100 * stat.normalized / 300).toFixed();
    });

    vm.formatTooltip = function(which) {
      var next = ' (' + vm.stats[which].value + '/300)';
      var tier = vm.stats[which].tier;
      var cooldown = vm.stats[which].cooldown || '';
      if (tier !== 5) {
        next = ' (' + $translate.instant('Stats.TierProgress', { progress: (vm.stats[which].value % 60) + "/60", tier: 'T' + (tier + 1) }) + ')';
      }
      if (cooldown) {
        cooldown = '\n' + $translate.instant('Cooldown.' + vm.stats[which].effect) + ": " + cooldown;
      }
      return 'T' + tier + ' ' + vm.stats[which].name + next + cooldown;
    };
  }
})();<commit_msg>Translate popup for hovering over stats<commit_after>(function() {
  'use strict';

  angular.module('dimApp')
    .directive('dimStats', Stats);

  Stats.$inject = [];

  function Stats() {
    return {
      controller: StatsCtrl,
      controllerAs: 'vm',
      bindToController: true,
      scope: {
        stats: '='
      },
      template: [
        '<div class="stat-bars">',
        '  <div class="stat" title="{{vm.formatTooltip(\'STAT_INTELLECT\')}}">',
        '    <img src="images/intellect.png">',
        '    <div class="bar" ng-repeat="n in vm.stats.STAT_INTELLECT.tiers track by $index">',
        '      <div class="progress" ng-class="{complete: (n / 60) === 1 }" dim-percent-width="n / 60"></div>',
        '    </div>',
        '  </div>',
        '  <div class="stat" title="{{vm.formatTooltip(\'STAT_DISCIPLINE\')}}">',
        '    <img src="images/discipline.png">',
        '    <div class="bar" ng-repeat="n in vm.stats.STAT_DISCIPLINE.tiers track by $index">',
        '      <div class="progress" ng-class="{complete: (n / 60) === 1 }" dim-percent-width="n / 60"></div>',
        '    </div>',
        '  </div>',
        '  <div class="stat" title="{{vm.formatTooltip(\'STAT_STRENGTH\')}}">',
        '    <img src="images/strength.png">',
        '    <div class="bar" ng-repeat="n in vm.stats.STAT_STRENGTH.tiers track by $index">',
        '      <div class="progress" ng-class="{complete: (n / 60) === 1 }" dim-percent-width="n / 60"></div>',
        '    </div>',
        '  </div>',
        '</div>'
      ].join('')
    };
  }

  StatsCtrl.$inject = ['$translate'];

  function StatsCtrl($translate) {
    var vm = this;

    _.each(vm.stats, function(stat) {
      stat.normalized = stat.value > 300 ? 300 : stat.value;
      stat.tier = Math.floor(stat.normalized / 60);
      stat.tiers = [];
      stat.remaining = stat.value;
      for (var t = 0; t < 5; t++) {
        stat.remaining -= stat.tiers[t] = stat.remaining > 60 ? 60 : stat.remaining;
      }
      stat.percentage = (100 * stat.normalized / 300).toFixed();
    });

    vm.formatTooltip = function(which) {
      var next = ' (' + vm.stats[which].value + '/300)';
      var tier = vm.stats[which].tier;
      var cooldown = vm.stats[which].cooldown || '';
      if (tier !== 5) {
        next = ' (' + $translate.instant('Stats.TierProgress', { progress: (vm.stats[which].value % 60) + "/60", tier: 'T' + (tier + 1) }) + ')';
      }
      if (cooldown) {
        cooldown = '\n' + $translate.instant('Cooldown.' + vm.stats[which].effect) + ": " + cooldown;
      }
      return 'T' + tier + ' ' + $translate.instant('Stats.' + vm.stats[which].name) + next + cooldown;
    };
  }
})();
{'fraction_non_alphanumeric': 0.21129667855132295, 'fraction_numerical': 0.01651341715143554, 'mean_word_length': 2.2941903584672434, 'pattern_counts': {'":': 2, '<': 51, '<?xml version=': 0, '>': 53, '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': '1353373', 'n_tokens_mistral': 1929, 'n_tokens_neox': 1821, 'n_words': 340}