From 98723d6c1b25f3592dd47d57541b8ed7ec0c728b Mon Sep 17 00:00:00 2001 From: Tdxdxoz Date: Thu, 12 Nov 2020 02:34:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=85=E6=98=BE=E7=A4=BA=E5=85=A5=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 5 ++++- templates/list.html | 15 +++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 56b928b..cadf2cd 100644 --- a/app.py +++ b/app.py @@ -100,12 +100,15 @@ def set_session(): def can_list(): key = request.args.get('key') sort_by = request.args.get('sort_by', 'time') + final_list = request.args.get('final_list', '') if 'uid' not in session: return redirect('set_session') uid = session.get('uid') q = Candidate.query + if final_list and C.step2.get('final_list'): + q = q.filter(Candidate.id.in_(C.step2['final_list'])) q = q.order_by(db.desc('likeNum')) if sort_by=='likeNum' else q.order_by(db.desc('id')) pag = q.paginate(max_per_page=100) @@ -122,7 +125,7 @@ def can_list(): } for name, ques, hint, ans in C.verify ] - return render_template('list.html', pagination=pag, vs=vs, verified=session.get('verified'), showPrivate=(key==C.key), sort_by=sort_by, key=key, base_toot_url='https://%s/web/statuses/' % C.domain, step2=C.step2, text1=C.text1, text2=C.text2) + return render_template('list.html', pagination=pag, vs=vs, verified=session.get('verified'), showPrivate=(key==C.key), sort_by=sort_by, key=key, final_list=final_list,base_toot_url='https://%s/web/statuses/' % C.domain, step2=C.step2, text1=C.text1, text2=C.text2) @app.route('/ordinary/new', methods=['POST']) @limiter.limit("5 / hour; 1 / 2 second") diff --git a/templates/list.html b/templates/list.html index faf0bdd..72bdc6c 100644 --- a/templates/list.html +++ b/templates/list.html @@ -237,11 +237,12 @@ {% if step2 %} -
+
-

现已进入“答辩”阶段。入围的选手会在闭社平台上发布更详细的陈述,并与观众在评论区互动。前往 thu.closed.social/tags/特普通奖答辩 围观。

+

现已进入“答辩”阶段。入围的选手会在闭社平台上发布更详细的陈述,并与观众在评论区互动。前往 thu.closed.social/tags/特普通奖答辩 围观。
+ (闭社需使用清华邮箱注册)

    {% for id, url in step2.get('cand', []) %}
  • {{id}}号选手
  • @@ -339,10 +340,16 @@

    已有报名

    + {% if final_list %} + 全部 | 仅入围 + {% else %} + 全部 | 仅入围 + {% endif %} +
    {% if sort_by == 'likeNum' %} - 按时间 | 按赞数 + 按时间 | 按赞数 {% else %} - 按时间 | 按赞数 + 按时间 | 按赞数 {% endif %}