Browse Source

仅显示入围

master
欧醚 4 years ago
parent
commit
98723d6c1b
Signed by: OmmyZhang GPG Key ID: 757D312E7C9D13F7
2 changed files with 15 additions and 5 deletions
  1. +4
    -1
      app.py
  2. +11
    -4
      templates/list.html

+ 4
- 1
app.py View File

@ -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")

+ 11
- 4
templates/list.html View File

@ -237,11 +237,12 @@
</div>
{% if step2 %}
<div class="step2-info">
<div class="step2-info mb-3">
<button type="button" class="close" aria-label="Close">
<span>&times;</span>
</button>
<p>现已进入“答辩”阶段。入围的选手会在闭社平台上发布更详细的陈述,并与观众在评论区互动。前往 <a href="https://thu.closed.social/tags/%E7%89%B9%E6%99%AE%E9%80%9A%E5%A5%96%E7%AD%94%E8%BE%A9">thu.closed.social/tags/特普通奖答辩</a> 围观。</p>
<p>现已进入“答辩”阶段。入围的选手会在闭社平台上发布更详细的陈述,并与观众在评论区互动。前往 <a href="https://thu.closed.social/tags/%E7%89%B9%E6%99%AE%E9%80%9A%E5%A5%96%E7%AD%94%E8%BE%A9">thu.closed.social/tags/特普通奖答辩</a> 围观。<br>
(闭社需使用清华邮箱注册)</p>
<ul>
{% for id, url in step2.get('cand', []) %}
<li style="animation: {{id*37 % 23 + 5}}s loop linear infinite;"><a href="{{url}}">{{id}}号选手</a></li>
@ -339,10 +340,16 @@
<div style="display:flex;justify-content:space-between;align-items: flex-end">
<h1>已有报名</h1>
<span style="margin:8px" class="sort-by">
{% if final_list %}
<a href="?sort_by={{sort_by}}&final_list=#part2">全部</a> | <b>仅入围</b>
{% else %}
<b>全部</b> | <a href="?sort_by={{sort_by}}&final_list=1#part2">仅入围</a>
{% endif %}
<br>
{% if sort_by == 'likeNum' %}
<a href="?sort_by=time#part2">按时间</a> | <b>按赞数</b>
<a href="?sort_by=time&final_list={{final_list}}#part2">按时间</a> | <b>按赞数</b>
{% else %}
<b>按时间</b> | <a href="?sort_by=likeNum#part2">按赞数</a>
<b>按时间</b> | <a href="?sort_by=likeNum&final_list={{final_list}}#part2">按赞数</a>
{% endif %}
</span>
</div>

Loading…
Cancel
Save