Skip to content
Snippets Groups Projects
Commit c71ed59a authored by Martin Mareš's avatar Martin Mareš
Browse files

Instance zadání existují na všech úrovních hierarchie

Jinak nefungovala práva k zadání.
parent 4bf470dc
Branches
No related tags found
1 merge request!122Různé drobné opravy
...@@ -2108,3 +2108,16 @@ def org_contest_scans_file(ct_id: int, job_id: int, file: str, site_id: Optional ...@@ -2108,3 +2108,16 @@ def org_contest_scans_file(ct_id: int, job_id: int, file: str, site_id: Optional
return send_file(path) return send_file(path)
else: else:
raise werkzeug.exceptions.NotFound() raise werkzeug.exceptions.NotFound()
@app.route('/org/contest/c/<int:ct_id>/task-statement/zadani.pdf')
@app.route('/org/contest/c/<int:ct_id>/site/<int:site_id>/task-statement/zadani.pdf')
@app.route('/org/contest/r/<int:round_id>/task-statement/zadani.pdf')
def org_task_statement(round_id: Optional[int] = None, ct_id: Optional[int] = None, site_id: Optional[int] = None):
ctx = get_context(round_id=round_id, ct_id=ct_id, site_id=site_id)
if not ctx.rights.can_view_statement():
app.logger.warn(f'Organizátor #{g.user.user_id} chce zadání, na které nemá právo')
raise werkzeug.exceptions.Forbidden()
return mo.web.util.send_task_statement(ctx.round)
...@@ -526,17 +526,6 @@ def _time_crossed(first_field: mo_fields.DateTime, second_field: mo_fields.DateT ...@@ -526,17 +526,6 @@ def _time_crossed(first_field: mo_fields.DateTime, second_field: mo_fields.DateT
return first is not None and second is not None and first > second return first is not None and second is not None and first > second
@app.route('/org/contest/r/<int:round_id>/task-statement/zadani.pdf')
def org_task_statement(round_id: int):
ctx = get_context(round_id=round_id)
if not ctx.rights.can_view_statement():
app.logger.warn(f'Organizátor #{g.user.user_id} chce zadání, na které nemá právo')
raise werkzeug.exceptions.Forbidden()
return mo.web.util.send_task_statement(ctx.round)
class StatementEditForm(FlaskForm): class StatementEditForm(FlaskForm):
file = flask_wtf.file.FileField("Soubor", render_kw={'autofocus': True}) file = flask_wtf.file.FileField("Soubor", render_kw={'autofocus': True})
upload = wtforms.SubmitField('Nahrát') upload = wtforms.SubmitField('Nahrát')
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<tr><td>Zadání<td> <tr><td>Zadání<td>
{% if round.tasks_file %} {% if round.tasks_file %}
{% if can_view_statement %} {% if can_view_statement %}
<a href='{{ ctx.url_for('org_task_statement', ct_id=None) }}'>stáhnout</a> <a href='{{ ctx.url_for('org_task_statement') }}'>stáhnout</a>
{% elif possible_rights_elsewhere %} {% elif possible_rights_elsewhere %}
viz stránka vaší soutěže/místa&nbsp;{{ rights_elsewhere_info() }} viz stránka vaší soutěže/místa&nbsp;{{ rights_elsewhere_info() }}
{% else %} {% else %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment