예제 #1
0
def query_handle():
    handle = None
    try:
        handle = request.args["handle"]
        conn = get_db_conn()
        cur = conn.cursor()
        handle, cid, rating = cur.execute(
            "SELECT handle, coder_id, alg_rating FROM coders " + "WHERE LOWER(handle) = LOWER(?)", [handle]
        ).fetchone()
    except Exception, e:
        flash("Could not find a user with handle '%s'." % handle)
        return render_template("landing.html", asof=rating_functions.as_of(conn))
예제 #2
0
def show_selector():
    return render_template("landing.html", asof=rating_functions.as_of(get_db_conn()))
예제 #3
0
            titles=["Match", "Problem", "%s Score" % handle, "Petr Score"],
            format=["%s", "%s", "<b>%0.2f</b>", "%0.2f"],
        )
        pvpetr_losses_table = utils.make_table(
            pvpetr_data[1],
            titles=["Match", "Problem", "%s Score" % handle, "Petr Score"],
            format=["%s", "%s", "%0.2f", "<b>%0.2f</b>"],
        )
        pvpetr = pvpetr_summary + pvpetr_wins_table + pvpetr_losses_table
    except Exception, e:
        error_msg = "Failed to read PvPetr for %s: %s" % (handle, e)
        app.logger.error(error_msg)
        flash(error_msg)

    try:
        asof = rating_functions.as_of(conn)
    except Exception, e:
        error_msg = "Failed to read last match time: %s" % e
        app.logger.error(error_msg)
        flash(error_msg)

    compliment = rating_functions.get_compliment(rating)

    return render_template(
        "tcstats.html",
        cid=cid,
        handle=handle,
        rating=rating,
        rounds=rounds,
        num_rounds=num_rounds,
        pvpetr=pvpetr,