From cf94668824a37c2d8f550ad6bfdfa51788283c31 Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Mon, 19 Apr 2021 11:15:34 +0200 Subject: [PATCH] =?UTF-8?q?Zru=C5=A1eno=20star=C3=A9=20pole=20place=5Fleve?= =?UTF-8?q?l=5Fnames?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mo/db.py | 2 -- mo/place_level.py | 2 +- mo/web/org_round.py | 3 +-- mo/web/templates/org_round.html | 2 +- mo/web/templates/org_rounds.html | 2 +- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/mo/db.py b/mo/db.py index 47eb48a0..effab7a0 100644 --- a/mo/db.py +++ b/mo/db.py @@ -86,8 +86,6 @@ place_type_names_and_levels = { PlaceType.site: ('Soutěžní místo', [4]), } -place_level_names = ['stát', 'kraj', 'okres', 'obec', 'škola'] - class Place(Base): __tablename__ = 'places' diff --git a/mo/place_level.py b/mo/place_level.py index 8ecc2ab4..2c4f631d 100644 --- a/mo/place_level.py +++ b/mo/place_level.py @@ -25,7 +25,7 @@ class PlaceLevel: def in_name(self) -> str: return self.in_prep + ' ' + self.name_loc - + place_levels = [ PlaceLevel(level=0, genus='m', in_prep='ve', diff --git a/mo/web/org_round.py b/mo/web/org_round.py index a2abf38e..dc2f20c2 100644 --- a/mo/web/org_round.py +++ b/mo/web/org_round.py @@ -55,7 +55,7 @@ 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, level_names=mo.db.place_level_names) + return render_template('org_rounds.html', rounds=rounds) class TaskDeleteForm(FlaskForm): @@ -228,7 +228,6 @@ def org_round(id: int): contests_counts=contests_counts, tasks=tasks, form_delete_task=form_delete_task, form_add_contest=form_add_contest, - level_names=mo.db.place_level_names, can_manage_round=can_manage_round, can_manage_contestants=can_manage_contestants, can_handle_submits=rr.have_right(Right.view_submits), diff --git a/mo/web/templates/org_round.html b/mo/web/templates/org_round.html index 5cf1afca..ad46f863 100644 --- a/mo/web/templates/org_round.html +++ b/mo/web/templates/org_round.html @@ -16,7 +16,7 @@ <tr><td>Kategorie<td>{{ round.category }} <tr><td>Pořadí<td>{{ round.seq }} {% if round.part > 0 %}<tr><td>Část<td>{{ round.part_code() }}{% endif %} - <tr><td>Oblast<td>{{ level_names[round.level] }} + <tr><td>Oblast<td>{{ round.get_level().name }} <tr><td>Vaše role<td>{% if g.user.is_admin %}správce{% elif roles %}{{ roles|join(", ") }}{% else %}–{% endif %} {% if group_rounds|length > 1 %} <tr><td>Skupina kol:<td> diff --git a/mo/web/templates/org_rounds.html b/mo/web/templates/org_rounds.html index 27e362af..fd336634 100644 --- a/mo/web/templates/org_rounds.html +++ b/mo/web/templates/org_rounds.html @@ -18,7 +18,7 @@ <td>{{ r.year }} <td>{{ r.category }} <td>{{ r.seq }}{{ r.part_code() }} - <td>{{ level_names[r.level] }} + <td>{{ r.get_level().name }} <td>{{ r.name }} <td class='rstate-{{r.state.name}}'>{{ r.state.friendly_name() }} {% endfor %} -- GitLab