예제 #1
0
def insert_teams(cursor, teams):
    now = datetime.datetime.utcnow()
    if (now < DEADLINE):
        info("Updating team information.")
        query.drop_teams(cursor)
        for captain in teams.iterkeys():
            loaddb.check_add_player(cursor, captain)
            canon_cap = query.canonicalize_player_name(cursor, captain)
            if canon_cap:
                query.create_team(cursor, teams[captain][0], canon_cap)
                for player in teams[captain][1]:
                    query.add_player_to_team(cursor, canon_cap, player)
    else:
        info("Team information frozen.")
예제 #2
0
파일: teams.py 프로젝트: jmbjr/dcss_tourney
def insert_teams(cursor, teams):
    now = datetime.datetime.utcnow()
    if (now < DEADLINE):
        info("Updating team information.")
        query.drop_teams(cursor)
        for captain in teams.iterkeys():
            loaddb.check_add_player(cursor, captain)
            canon_cap = query.canonicalize_player_name(cursor, captain)
            if canon_cap:
                query.create_team(cursor, teams[captain][0], canon_cap)
                for player in teams[captain][1]:
                    query.add_player_to_team(cursor, canon_cap, player)
    else:
        info("Team information frozen.")
예제 #3
0
def act_on_logfile_line(c, this_game):
  """Actually assign things and write to the db based on a logfile line
  coming through. All lines get written to the db; some will assign
  irrevocable points and those should be assigned immediately. Revocable
  points (high scores, lowest dungeon level, fastest wins) should be
  calculated elsewhere."""
  if game_is_win(this_game):
    crunch_winner(c, this_game) # lots of math to do for winners

  crunch_misc(c, this_game)

  if loaddb.is_ghost_kill(this_game):
    ghost = loaddb.extract_ghost_name(this_game['killer'])
    ghost = query.canonicalize_player_name(c, ghost)
    XL = this_game['xl']
    if XL > 5 and ghost:
      assign_team_points(c, "gkill", ghost, (XL - 5))
예제 #4
0
def act_on_logfile_line(c, this_game):
  """Actually assign things and write to the db based on a logfile line
  coming through. All lines get written to the db; some will assign
  irrevocable points and those should be assigned immediately. Revocable
  points (high scores, lowest dungeon level, fastest wins) should be
  calculated elsewhere."""
  if game_is_win(this_game):
    crunch_winner(c, this_game) # lots of math to do for winners

  crunch_misc(c, this_game)

  if loaddb.is_ghost_kill(this_game):
    ghost = loaddb.extract_ghost_name(this_game['killer'])
    ghost = query.canonicalize_player_name(c, ghost)
    XL = this_game['xl']
    if XL > 5 and ghost:
      assign_team_points(c, "gkill", ghost, (XL - 5))