示例#1
0
文件: views.py 项目: asivokon/hacktus
def codeforces():
    if 'cf_login' not in session:
        return redirect(url_for(settings))

    today = datetime.date.today()
    pr = CodeforcesProvider(session['cf_login'])
    return jsonify(pr.get_submissions(today))
示例#2
0
文件: views.py 项目: asivokon/hacktus
def cf_stats():
    if 'cf_login' not in session:
        return redirect(url_for(settings))

    result = {}
    name = session['cf_login']
    provider = CodeforcesProvider(name)
    now = datetime.date.today()
    result['daily'] = provider.get_stats_for_day(name, now)
    result['weekly'] = provider.get_stats_for_week(name)
    result['monthly'] = provider.get_stats_for_month(name)
    return jsonify({'result': result})