Exemplo n.º 1
0
def club_overview(club_id):
    club = get_club(club_id)

    quantifier_day = AthleteDistanceByDay(club)
    last_28_days = quantifier_day.last_28_days()[0:5]

    quantifier_week = AthleteDistanceByWeek(club)
    week_scoreboards = dict([(week, quantifier_week.scoreboard(week)) for week in [week_id(monday(0))]])

    return render_template('club-overview.html',
        club=club,
        last_28_days=last_28_days,
        week_scoreboards=week_scoreboards,
        week_id=week_id(monday(0)),
        week_start = monday(),
        week_end = monday(+1)
    )
Exemplo n.º 2
0
def weekly_scoreboard(club_id, first_week_id=None):
    week_per_request = 3
    base_date = week_id_to_date(first_week_id or week_id(monday()))
    mon = lambda i: monday(i, base_date)

    weeks = [(week_id(mon(-i)), mon(-i), mon(-i + 1))
             for i in range(0, week_per_request)]

    club = get_club(club_id)
    session['club_id'] = club_id
    quantifier = AthleteDistanceByWeek(club)
    week_scoreboards = dict((week[0], quantifier.scoreboard(week[0])) for week in weeks)

    return render_template('rides-by-week.html',
        club=club,
        week_scoreboards=week_scoreboards,
        weeks=weeks,
        next_week_id=week_id(mon(-week_per_request))
    )