예제 #1
0
def before_request():
    if '/static/' in request.url:
        # no need to do dynamic things on non-dynamic resources
        return

    g.website_timezone = pytz.timezone(app.config['WEBSITE_TIMEZONE'])

    g.players = get_players()
    g.ranking = [player.name for player in g.players]
    g.original_ranking = g.ranking[:]
    g.shouts = get_shouts()
    g.challenges = get_challenges()
    g.challengers = set(challenge.challenger.name for challenge in g.challenges)
    g.defenders = set(challenge.defender.name for challenge in g.challenges)
    g.challenged_players = sorted(g.challengers.union(g.defenders))
    g.absences = {
        p.name: str(p.absence)
        for p in g.players
        if p.absence is not None
    }
    g.drops = {
        p.name: p.rank_drop_at_game for p in g.players
        if p.rank_drop_at_game is not None
    }

    calculate_ranking()
예제 #2
0
def shoutbox():
    all_shouts = get_shouts(2000)
    return render_template(
        'show_shoutbox.html',
        shouts=all_shouts,
    )