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.")
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))