Пример #1
0
def api_stats_qtemplates_year(qt_id, year):
    """ Return the number of times the qtemplate was practiced in
        the given year, broken down by day
    """
    start_time = datetime.datetime(year=year, month=1, day=1, hour=0)
    end_time = datetime.datetime(year=year, month=12, day=31, hour=23)

    counts = Stats.daily_prac_q_count(start_time, end_time, qt_id)
    return jsonify(result=counts)
Пример #2
0
def api_stats_qtemplates_year(qt_id, year):
    """ Return the number of times the qtemplate was practiced in
        the given year, broken down by day
    """
    start_time = datetime.datetime(year=year, month=1, day=1, hour=0)
    end_time = datetime.datetime(year=year, month=12, day=31, hour=23)

    counts = Stats.daily_prac_q_count(start_time, end_time, qt_id)
    return jsonify(result=counts)
Пример #3
0
def api_stats_qtemplates_3month(qt_id):
    """ Return the number of times the qtemplate was practiced in approx
        the last three months
    """
    month3 = datetime.timedelta(weeks=12)
    days3 = datetime.timedelta(days=3)

    now = datetime.datetime.now()
    end_time = now+days3
    start_time = now-month3

    counts = Stats.daily_prac_q_count(start_time, end_time, qt_id)
    return jsonify(result=counts)
Пример #4
0
def api_stats_practice_load():
    """ Return the number of times any qtemplate was practiced in
        approx the last three months
    """
    month3 = datetime.timedelta(weeks=12)
    days3 = datetime.timedelta(days=3)

    now = datetime.datetime.now()
    end_time = now + days3
    start_time = now - month3

    counts = Stats.daily_prac_load(start_time, end_time)
    return jsonify(result=counts)