예제 #1
0
 def get_player(self, locale=None):
     self.change_locale(locale)
     pl = Player(self.get_person())
     pl.role = self.faker.player_role()
     pl.age = self.faker.age()
     pl.nationality = self.locale
     return pl
예제 #2
0
  def DoGet(self):
    # By loading and storing each player, we're updating the player for any
    # schema changes.
    # This will not work once we have more than 1000 records, but it's fine for now.
    for player in Player.all():
      player.put()

    for game in Game.all():
      game.put()

    self.render_to_response("update_schema.html")
예제 #3
0
  def DoGet(self):

    logging.info('Calculating ELO rankings')
    # Reset ranks
    for player in Player.all():
      player.rank = elo.INITIAL_RANK
      player.put()

    # Calculate ranks for games in ascending order, since the order matters for ELO
    for game in Game.all_completed_asc():
      logging.info('Updating rankings based on game completed at %s:  %s' % (game.completed_date, game))
      elo.update_ranks(game)
      game.player_1.put()
      game.player_2.put()

    self.render_to_response("calculate_elo_rankings.html")