コード例 #1
0
ファイル: stats.py プロジェクト: crawl/scoring
def update_player_recent_games(c, g):
  player = g['name']
  insert_game(c, g, 'player_recent_games')
  if player_recent_game_count.has_key(player):
    player_recent_game_count.set_key(player_recent_game_count(c, player) + 1,
                                     player)
  if player_recent_game_count(c, player) > MAX_PLAYER_RECENT_GAMES + 50:
    extra = player_recent_game_count(c, player) - MAX_PLAYER_RECENT_GAMES
    ids = query_first_col(c, '''SELECT id FROM player_recent_games
                                 WHERE name = %s ORDER BY id LIMIT %s''',
                          player, extra)
    scload.delete_table_rows_by_id(c, 'player_recent_games', ids)
    player_recent_game_count.flush_key(player)
コード例 #2
0
ファイル: stats.py プロジェクト: floraline/scoring
def update_player_recent_games(c, g):
    player = g['name']
    insert_game(c, g, 'player_recent_games')
    if player_recent_game_count.has_key(player):
        player_recent_game_count.set_key(
            player_recent_game_count(c, player) + 1, player)
    if player_recent_game_count(c, player) > MAX_PLAYER_RECENT_GAMES + 50:
        extra = player_recent_game_count(c, player) - MAX_PLAYER_RECENT_GAMES
        ids = query_first_col(
            c, '''SELECT id FROM player_recent_games
                                 WHERE name = %s ORDER BY id LIMIT %s''',
            player, extra)
        scload.delete_table_rows_by_id(c, 'player_recent_games', ids)
        player_recent_game_count.flush_key(player)
コード例 #3
0
ファイル: stats.py プロジェクト: elliptic/dcss_scoring
def update_player_recent_games(c, g):
  player = g['name']
  insert_game(c, g, 'player_recent_games')
  if player_recent_game_count.has_key(player):
    player_recent_game_count.set_key(player_recent_game_count(c, player) + 1,
                                     player)
  if player_recent_game_count(c, player) > MAX_PLAYER_RECENT_GAMES + 50:
    extra = player_recent_game_count(c, player) - MAX_PLAYER_RECENT_GAMES
    ids = query_first_col(c, '''SELECT id FROM player_recent_games
                                 WHERE name = %s ORDER BY id LIMIT %s''',
                          player, extra)
    query_do(c, '''DELETE FROM player_recent_games WHERE id IN (%s)''',
             ",".join([str(x) for x in ids]))
    player_recent_game_count.flush_key(player)
コード例 #4
0
ファイル: stats.py プロジェクト: crawl/scoring
def update_all_recent_games(c, g):
  if is_junk_game(g):
    return

  dirty_page('recent', 1)
  dirty_page('per-day', 1)
  insert_game(c, g, 'all_recent_games')
  if all_recent_game_count.has_key():
    all_recent_game_count.set_key(all_recent_game_count(c) + 1)

  if all_recent_game_count(c) > MAX_ALL_RECENT_GAMES + 50:
    extra = all_recent_game_count(c) - MAX_ALL_RECENT_GAMES
    ids = query_first_col(c, '''SELECT id FROM all_recent_games
                                 ORDER BY id LIMIT %s''',
                          extra)
    scload.delete_table_rows_by_id(c, 'all_recent_games', ids)
    all_recent_game_count.flush_key()
コード例 #5
0
ファイル: stats.py プロジェクト: floraline/scoring
def update_all_recent_games(c, g):
    if is_junk_game(g):
        return

    dirty_page('recent', 1)
    dirty_page('per-day', 1)
    insert_game(c, g, 'all_recent_games')
    if all_recent_game_count.has_key():
        all_recent_game_count.set_key(all_recent_game_count(c) + 1)

    if all_recent_game_count(c) > MAX_ALL_RECENT_GAMES + 50:
        extra = all_recent_game_count(c) - MAX_ALL_RECENT_GAMES
        ids = query_first_col(
            c, '''SELECT id FROM all_recent_games
                                 ORDER BY id LIMIT %s''', extra)
        scload.delete_table_rows_by_id(c, 'all_recent_games', ids)
        all_recent_game_count.flush_key()
コード例 #6
0
ファイル: stats.py プロジェクト: elliptic/dcss_scoring
def update_all_recent_games(c, g):
  if is_junk_game(g):
    return

  dirty_page('recent', 1)
  dirty_page('per-day', 1)
  insert_game(c, g, 'all_recent_games')
  if all_recent_game_count.has_key():
    all_recent_game_count.set_key(all_recent_game_count(c) + 1)

  if all_recent_game_count(c) > MAX_ALL_RECENT_GAMES + 50:
    extra = all_recent_game_count(c) - MAX_ALL_RECENT_GAMES
    ids = query_first_col(c, '''SELECT id FROM all_recent_games
                                 ORDER BY id LIMIT %s''',
                          extra)
    query_do(c, '''DELETE FROM all_recent_games WHERE id IN (%s)''',
             ",".join([str(x) for x in ids]))
    all_recent_game_count.flush_key()
コード例 #7
0
ファイル: query.py プロジェクト: elliptic/dcss_scoring
def all_races(c):
  scload.bootstrap_known_raceclasses(c)
  races = query_first_col(c, '''SELECT race FROM known_races''')
  races.sort()
  return races
コード例 #8
0
ファイル: query.py プロジェクト: elliptic/dcss_scoring
def all_classes(c):
  scload.bootstrap_known_raceclasses(c)
  clx = query_first_col(c, '''SELECT cls FROM known_classes''')
  clx.sort()
  return clx
コード例 #9
0
ファイル: query.py プロジェクト: elliptic/dcss_scoring
def find_all_players(c):
  return query_first_col(c, '''SELECT name FROM players''')
コード例 #10
0
def all_races(c):
    scload.bootstrap_known_raceclasses(c)
    races = query_first_col(c, '''SELECT race FROM known_races''')
    races.sort()
    return races
コード例 #11
0
def all_classes(c):
    scload.bootstrap_known_raceclasses(c)
    clx = query_first_col(c, '''SELECT cls FROM known_classes''')
    clx.sort()
    return clx
コード例 #12
0
def find_all_players(c):
    return query_first_col(c, '''SELECT name FROM players ORDER BY name''')