<commit_before>
if Meteor.isClient
  angular.module('kurea.web').controller 'IdleCollectibles', [
    '$scope', '$stateParams', '$collection', '$subscribe', 'IdleCollections', 'PageTitle',
    ($scope, $stateParams, $collection, $subscribe, IdleCollections, PageTitle) =>
      $scope._ = window._
      $scope.playerName = $stateParams.playerName

      PageTitle.setTitle "Idle Lands - #{if $stateParams.playerName then "#{$stateParams.playerName} (Collectibles)" else "Global Collectibles"}"

      $scope.getCollectibles = ->
        if $scope.playerName then $scope.player?[0].collectibles else $scope.calculatedCollectibles

      $scope.calculateCollectibles = ->
        collectibleFinalList = []
        calculatedCollectibles = []

        _.each $scope.players, (player) -> calculatedCollectibles.push player.collectibles...

        groupedCollectibles = _.groupBy calculatedCollectibles, 'name'

        _.each (_.keys groupedCollectibles), (key) ->
          collectible = groupedCollectibles[key][0]
          collectible.achieved = groupedCollectibles[key].length
          collectible.percent = ((parseInt collectible.achieved / $scope.players.length*100).toFixed 0)
          collectibleFinalList.push collectible

        sortedCollectibles = _.sortBy collectibleFinalList, (collectible) -> collectible.name
        $scope.calculatedCollectibles = sortedCollectibles

      if $scope.playerName
        $subscribe.subscribe 'singlePlayer', $stateParams.playerName
        .then ->
          $collection IdleCollections.IdlePlayers, name: $stateParams.playerName
          .bind $scope, 'player'
      else<commit_msg>alphabetizing player collectibles, closes #34<commit_after>
if Meteor.isClient
  angular.module('kurea.web').controller 'IdleCollectibles', [
    '$scope', '$stateParams', '$collection', '$subscribe', 'IdleCollections', 'PageTitle',
    ($scope, $stateParams, $collection, $subscribe, IdleCollections, PageTitle) =>
      $scope._ = window._
      $scope.playerName = $stateParams.playerName

      PageTitle.setTitle "Idle Lands - #{if $stateParams.playerName then "#{$stateParams.playerName} (Collectibles)" else "Global Collectibles"}"

      $scope.getCollectibles = ->
        if $scope.playerName then _.sortBy $scope.player?[0].collectibles, (col) -> col.name else $scope.calculatedCollectibles

      $scope.calculateCollectibles = ->
        collectibleFinalList = []
        calculatedCollectibles = []

        _.each $scope.players, (player) -> calculatedCollectibles.push player.collectibles...

        groupedCollectibles = _.groupBy calculatedCollectibles, 'name'

        _.each (_.keys groupedCollectibles), (key) ->
          collectible = groupedCollectibles[key][0]
          collectible.achieved = groupedCollectibles[key].length
          collectible.percent = ((parseInt collectible.achieved / $scope.players.length*100).toFixed 0)
          collectibleFinalList.push collectible

        sortedCollectibles = _.sortBy collectibleFinalList, (collectible) -> collectible.name
        $scope.calculatedCollectibles = sortedCollectibles

      if $scope.playerName
        $subscribe.subscribe 'singlePlayer', $stateParams.playerName
        .then ->
          $collection IdleCollections.IdlePlayers, name: $stateParams.playerName
          .bind $scope, 'player'
      else
{'fraction_non_alphanumeric': 0.1167466986794718, 'fraction_numerical': 0.004201680672268907, 'mean_word_length': 3.516260162601626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '4153741', 'n_tokens_mistral': 921, 'n_tokens_neox': 886, 'n_words': 180}