From 245e6be8af4ae77bd2865091347b37a863b43e81 Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Mon, 12 Jul 2021 15:41:10 +0200 Subject: [PATCH] =?UTF-8?q?Samostatn=C3=A1=20str=C3=A1nka=20na=20p=C5=99eh?= =?UTF-8?q?led=20kol=20v=C5=A1ech=20ro=C4=8Dn=C3=ADk=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Na /org/contest/ ukazujeme jen aktuální ročník. --- mo/web/org_round.py | 10 +++++++++- mo/web/templates/org_rounds.html | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mo/web/org_round.py b/mo/web/org_round.py index 7fc300ec..58009872 100644 --- a/mo/web/org_round.py +++ b/mo/web/org_round.py @@ -55,7 +55,15 @@ def org_rounds(): sess = db.get_session() rounds = sess.query(db.Round).filter_by(year=mo.current_year).order_by(db.Round.year, db.Round.category, db.Round.seq, db.Round.part) - return render_template('org_rounds.html', rounds=rounds) + return render_template('org_rounds.html', rounds=rounds, history=False) + + +@app.route('/org/contest/history') +def org_rounds_history(): + sess = db.get_session() + + rounds = sess.query(db.Round).order_by(db.Round.year.desc(), db.Round.category, db.Round.seq, db.Round.part) + return render_template('org_rounds.html', rounds=rounds, history=True) class TaskDeleteForm(FlaskForm): diff --git a/mo/web/templates/org_rounds.html b/mo/web/templates/org_rounds.html index fd336634..d4b415dc 100644 --- a/mo/web/templates/org_rounds.html +++ b/mo/web/templates/org_rounds.html @@ -23,4 +23,10 @@ <td class='rstate-{{r.state.name}}'>{{ r.state.friendly_name() }} {% endfor %} </table> + +{% if history %} + <p><a class='btn btn-default' href='{{ url_for('org_rounds') }}'>Aktuální ročník</a> +{% else %} + <p><a class='btn btn-default' href='{{ url_for('org_rounds_history') }}'>Všechny ročníky</a> +{% endif %} {% endblock %} -- GitLab