<commit_before>cachedSubs = new SubsManager(
  cacheLimit: 10
  expireIn: 9999
)

# #########
# Profile

ProfileController = RouteController.extend
  template: 'profile'
  # waitOn: ->
  #   cachedSubs.subscribe "playerGroups"
  #   cachedSubs.subscribe "groupPoints"
  # playerGroups: ->
  #   Groups.find {},
  #     playerIds:
  #       $in: [Meteor.userId()]
  #
  #     sort:
  #       createdAt: -1
  #       _id: -1
  userProfile: ->
    console.log Meteor.users
    console.log Meteor.userId()
    Meteor.users.findOne()

  data: ->
    @userProfile()



Router.map () ->
    @route 'profile',
        path :  '/profile'
        controller :  ProfileController
    return

# #########
# Games

GamesController = RouteController.extend
  template: 'games'
  waitOn: ->
    [
      Meteor.subscribe 'playerGames'
      cachedSubs.subscribe "playerGroups"
    ]

  games: ->
    Games.find {}, {sort: {createdAt: -1, _id: -1}}
  data: ->
    games: @games()<commit_msg>Fixes slow loading of games side due to fetching all games played so far<commit_after>cachedSubs = new SubsManager(
  cacheLimit: 10
  expireIn: 9999
)

# #########
# Profile

ProfileController = RouteController.extend
  template: 'profile'
  # waitOn: ->
  #   cachedSubs.subscribe "playerGroups"
  #   cachedSubs.subscribe "groupPoints"
  # playerGroups: ->
  #   Groups.find {},
  #     playerIds:
  #       $in: [Meteor.userId()]
  #
  #     sort:
  #       createdAt: -1
  #       _id: -1
  userProfile: ->
    console.log Meteor.users
    console.log Meteor.userId()
    Meteor.users.findOne()

  data: ->
    @userProfile()



Router.map () ->
    @route 'profile',
        path :  '/profile'
        controller :  ProfileController
    return

# #########
# Games

GamesController = RouteController.extend
  template: 'games'
  waitOn: ->
    [
      cachedSubs.subscribe 'playerGames'
      cachedSubs.subscribe "playerGroups"
    ]

  games: ->
    Games.find( {}, {sort: {createdAt: -1, _id: -1}}, {limit: 10})
  data: ->
    games: @games()
{'fraction_non_alphanumeric': 0.14906219151036526, 'fraction_numerical': 0.01085883514313919, 'mean_word_length': 2.5437062937062938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6058881', 'n_tokens_mistral': 718, 'n_tokens_neox': 690, 'n_words': 140}