def judge_state(): query = JudgeState.query.order_by(db.desc(JudgeState.id)) nickname = request.args.get("submitter") problem_id = request.args.get("problem_id") if request.args.get("submitter"): submitter = User.query.filter_by(nickname=nickname).first() if submitter: submitter_id = submitter.id else: submitter_id = 0 query = query.filter_by(user_id=submitter_id) if request.args.get("problem_id"): query = query.filter_by(problem_id=int(problem_id)) def make_url(page, other): other["page"] = page return url_for("judge_state") + "?" + urlencode(other) if not nickname: nickname = "" if not problem_id: problem_id = "" sorter = Paginate(query, make_url=make_url, other={"submitter": nickname, "problem_id": problem_id}, cur_page=request.args.get("page"), edge_display_num=3, per_page=10) return render_template("judge_state.html", user=User.get_cur_user(), judges=sorter.get(), tab="judge", submitter=nickname, problem_id=problem_id, sorter=sorter, encode=urlencode, tool=Tools)
def contest_list(): query = Contest.query.order_by(db.desc(Contest.start_time)) def make_url(page, other): return url_for("contest_list") + "?" + urlencode({"page": page}) sorter = Paginate(query, make_url=make_url, cur_page=request.args.get("page"), edge_display_num=3, per_page=10) return render_template("contest_list.html", tool=Tools, sorter=sorter, now=time.time())
def info(): query = User.query.order_by(db.desc(User.ac_num)) notice = Notice.query.all() ranker = Paginate(query, cur_page=1, per_page=10) return render_template("info.html", tool=Tools, tab="info", notice=notice, ranker=ranker)
def ranklist(): query = User.query.order_by(db.desc(User.ac_num)) def make_url(page, other): return url_for("ranklist") + "?" + Tools.url_encode({"page": page}) sorter = Paginate(query, make_url=make_url, cur_page=request.args.get("page"), edge_display_num=3, per_page=50) return render_template("ranklist.html", tool=Tools, sorter=sorter, tab="ranklist")
def index(): query = User.query.order_by(db.desc(User.ac_num)) ranker = Paginate(query, cur_page=1, per_page=10) return render_template("index.html", tool=Tools, tab="index", ranker=ranker)