Esempio n. 1
0
def player_page(c, player):
    info("Updating player page for %s" % player)
    stats = query.get_player_stats(c, player)
    player_params = {
        'player':
        player,
        'score_full':
        stats['score_full'],
        'total_number_of_players':
        stats['rank2'],
        'overall_rank':
        stats['rank1'],
        'individual_category_results':
        player_individual_category_results(c, player),
        #'clan_category_results': player_clan_category_results(c, player),
        'banner_results':
        player_banner_results(c, player),
    }
    _clan_info = query.get_clan_info(c, player)
    if _clan_info is None:
        _clan_info = (None, [], None)
    player_params['clan_name'] = _clan_info[0]
    player_params['clan_members'] = _clan_info[1]
    player_params['clan_url'] = _clan_info[2]
    render(c,
           'player',
           dest=('%s/%s' % (crawl_utils.PLAYER_BASE, player.lower())),
           pars=player_params,
           top_level_pars=True)
Esempio n. 2
0
def clan_affiliation(c, player, include_clan=True):
  # Clan affiliation info is clan name, followed by a list of players,
  # captain first, or None if the player is not in a clan.
  clan_info = query.get_clan_info(c, player)
  if clan_info is None:
    return "None"

  clan_name, players = clan_info
  if include_clan:
    clan_html = linked_text(players[0], clan_link, clan_name) + " - "
  else:
    clan_html = ''

  plinks = [ linked_text(players[0], player_link) + " (captain)" ]

  other_players = sorted(players[1:])
  for p in other_players:
    plinks.append( linked_text(p, player_link) )

  clan_html += ", ".join(plinks)
  return clan_html
Esempio n. 3
0
def clan_affiliation(c, player, include_clan=True):
  # Clan affiliation info is clan name, followed by a list of players,
  # captain first, or None if the player is not in a clan.
  clan_info = query.get_clan_info(c, player)
  if clan_info is None:
    return "None"

  clan_name, players = clan_info
  if include_clan:
    clan_html = linked_text(players[0], clan_link, clan_name) + " - "
  else:
    clan_html = ''

  plinks = [ linked_text(players[0], player_link) + " (captain)" ]

  other_players = sorted(players[1:])
  for p in other_players:
    plinks.append( linked_text(p, player_link) )

  clan_html += ", ".join(plinks)
  return clan_html
Esempio n. 4
0
def team_page(c, captain):
    clan_info = query.get_clan_info(c, captain)
    assert clan_info is not None
    clan_name = clan_info[0]
    info("Updating team page for %s" % clan_name)

    stats = query.get_clan_stats(c, captain)

    pars = {
        'captain': captain,
        'clan_name': clan_name,
        'clan_members': clan_info[1],
        'overall_rank': stats['rank1'],
        'total_number_of_clans': stats['rank2'],
        'clan_category_results': clan_category_results(c, clan_name),
    }
    render(
        c,
        'clan',
        dest='%s/%s' % (crawl_utils.CLAN_BASE,
                        crawl_utils.clan_page_name(clan_name, captain)),
        pars=pars,
        top_level_pars=True,
    )