Select Git revision
org_contest.html 9.94 KiB
{% extends "base.html" %}
{% set round = contest.round %}
{% set state = contest.state %}
{% set ct_state = contest.ct_state() %}
{% set can_manage = rights.have_right(Right.manage_contest) %}
{% set can_upload = rights.can_upload_feedback() %}
{% set can_edit_points = not site and rights.can_edit_points() %}
{% set can_create_solutions = rights.can_upload_feedback() or rights.can_upload_solutions() %}
{% set offer_view_statement, offer_view_statement_reason = rights.offer_view_statement() %}
{% set can_view_contestants = rights.have_right(Right.view_contestants) %}
{% set can_view_submits = rights.can_view_submits() %}
{% block title %}
{{ round.name }} {{ round.category }} {{ contest.place.name_locative() }}
{% endblock %}
{% block breadcrumbs %}
{{ ctx.breadcrumbs() }}
{% endblock %}
{% block body %}
{% if site %}
<h3>Soutěžní místo: {{ site.name }}</h3>
{% endif %}
{% if not site %}
<div class="row">
<div class="col-sm-7">
<div class="panel panel-default">
<table class="table table-bordered">
<tr>
<td>Zadání úloh
<td>
{% if offer_view_statement %}
<a class="btn btn-default" href='{{ ctx.url_for('org_task_statement', ct_id=None) }}'>
<img class="media-object" src="{{ url_for('static', filename='img/pdficon.svg') }}" alt="PDF" style="width: 24px; display: inline-block">
Stáhnout
</a>
{% else %}
{{ offer_view_statement_reason }}
{% endif %}
<tr><td>Moje role<td>{% if g.user.is_admin %}správce{% elif roles %}{{ roles|join(", ") }}{% else %}–{% endif %}
{% if group_contests|length > 1 %}
<tr><td>Soutěže ve skupině kol<td>
{% for c in group_contests %}
{% if c != contest %}<a href="{{ url_for('org_contest', ct_id=c.contest_id, site_id=(site.place_id if site else None)) }}">{% endif %}
{{ c.round.name }} {{ c.round.category }}
{% if c != contest %}</a>{% endif %}<br>
{% endfor %}
{% endif %}
</table>
{% if can_manage or g.user.is_admin %}
<div class="panel-footer">
{% if can_manage %}
<a class="btn btn-xs btn-default" href='{{ ctx.url_for('org_contest_edit') }}'><span class="glyphicon glyphicon-cog"></span> Nastavení</a>
{% endif %}
{% if g.user.is_admin %}
<a class="btn btn-xs btn-info" href="{{ log_url('contest', ctx.ct_id) }}">Historie</a>
{% endif %}
</div>
{% endif %}
</div>
</div>
<div class="col-sm-5">
<div
{% if state == RoundState.preparing %}
class="panel panel-warning"
{% elif state == RoundState.running %}
class="panel panel-success"
{% elif state == RoundState.grading %}
class="panel panel-info"
{% else %}
class="panel panel-default"
{% endif %}>
<div class="panel-heading">
<h3 class="panel-title">
{% if state == RoundState.preparing %}
<span class="glyphicon glyphicon-star"></span>
{% elif state == RoundState.running %}
<span class="glyphicon glyphicon-play"></span>
{% elif state == RoundState.grading %}
<span class="glyphicon glyphicon-pencil"></span>
{% else %}
<span class="glyphicon glyphicon-stop"></span>
{% endif %}
Stav soutěže
</h3>
</div>
<div class="panel-body">
<p style="display: inline-block; padding-right: 1rem">
{{ round.name }} <b>{{ state.friendly_name()|replace("opravuje se", "se opravuje")|replace("připravuje se", "se připravuje") }}</b>
{% if round.state != RoundState.delegate %}
(určeno nastavením kola)
{% elif can_manage and not site %}
{% if state == RoundState.running %}
<form method="post" action="{{ url_for('org_contest_edit', ct_id=contest.contest_id) }}" style="display: inline-block">
{{ edit_form.csrf_token }}
<button type="submit" class="btn btn-sm btn-default">Změnit na: opravuje se</button>
<input type="hidden" name="state" value="{{ RoundState.grading.name }}">
</form>
{% elif state == RoundState.grading %}
<form method="post" action="{{ url_for('org_contest_edit', ct_id=contest.contest_id) }}" style="display: inline-block">
{{ edit_form.csrf_token }}
<button type="submit" class="btn btn-sm btn-default">Změnit na: ukončeno</button>
<input type="hidden" name="state" value="{{ RoundState.closed.name }}">
</form>
{% endif %}
{% endif %}
{% if state != ct_state %}
<p>Účastníci vidí stav: {{ ct_state.friendly_name() }}
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
<div class="row">
{% if can_view_contestants or can_manage %}
<div class="col-md-7">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-user"></span>
Účastníci
{% if places_counts %}
(celkem {{ places_counts|sum(attribute=1) }})
{% endif %}
</h3>
</div>
<div class="panel-body">
{% if can_view_contestants %}
<a class="btn btn-primary" href='{{ ctx.url_for('org_generic_list') }}'><span class="glyphicon glyphicon-check"></span> Seznam</a>
{% endif %}
{% if can_manage %}
<a class="btn btn-default" href="{{ ctx.url_for('org_contest_add_user') }}"><span class="glyphicon glyphicon-plus-sign"></span> Přidat</a>
{% if not site and state != RoundState.closed and round.seq > 1 %}
<a class="btn btn-default" href='{{ ctx.url_for('org_contest_advance') }}'><span class="glyphicon glyphicon-circle-arrow-up"></span> Postup z minulého kola</a>
{% endif %}
{% if not site %}
<a class="btn btn-default" href='{{ ctx.url_for('org_generic_import') }}'><span class="glyphicon glyphicon-import"></span> Importovat CSV</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endif %}
{% if (can_view_submits and state != RoundState.preparing) or can_upload or (not site and can_view_contestants and (state == RoundState.grading or state == RoundState.closed)) %}
<div class="col-md-5">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-duplicate"></span>
Odevzdaná řešení a opravy
</h3>
</div>
<div class="panel-body">
{% if can_view_submits and state != RoundState.preparing %}
<a class="btn btn-success" href='{{ ctx.url_for('org_contest_solutions') }}'><span class="glyphicon glyphicon-th-list"></span> Tabulka řešení</a>
{% endif %}
{% if not site and can_view_contestants and (state == RoundState.grading or state == RoundState.closed) %}
<a class="btn btn-warning" href='{{ ctx.url_for('org_score') }}'><span class="glyphicon glyphicon-bullhorn"></span> Výsledky</a>
{% endif %}
{% if can_upload %}
<a class='btn btn-default' href="{{ ctx.url_for('org_generic_batch_upload') }}">
<span class="glyphicon glyphicon-cloud-upload"></span> Nahrát ZIP
</a>
{% endif %}
</div>
</div>
</div>
{% elif not site and state == RoundState.closed %}
<div class="col-md-12">
<a class="btn btn-lg btn-warning" href='{{ ctx.url_for('public_score') }}'><span class="glyphicon glyphicon-bullhorn"></span> Výsledky</a>
</div>
{% endif %}
</div>
{% if not site and places_counts|length > 1 %}
<h3>Soutěžní místa</h3>
<table class="table table-bordered table-auto">
<thead>
<tr><th>Místo<th>Počet účastníků<th>Akce
</thead>
{% for (place, count) in places_counts %}
<tr>
<td><a href="{{ ctx.url_for('org_contest', site_id=place.place_id) }}">{{ place.name }}</a>
<td>{{ count }}
<td><div class="btn-group">
<a class="btn btn-xs btn-primary" href="{{ ctx.url_for('org_contest', site_id=place.place_id) }}">Detail</a>
{% if can_manage %}
<a class="btn btn-xs btn-default" href="{{ ctx.url_for('org_contest_add_user', site_id=place.place_id) }}">Přidat účastníka</a>
</div>
{% endif %}
</tr>
{% endfor %}
<tfoot>
<tr>
<th>Celkem
<th>{{ places_counts|sum(attribute=1) }}
<th>
</tr>
</tfoot>
</table>
{% endif %}
<h3>Úlohy</h3>
{% if tasks %}
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Kód
<th>Název
<th>Odevzdaná řešení
<th>Maximum bodů
<th>Jednotlivé akce
<th>Dávkové operace
</tr>
</thead>
{% for task in tasks %}
<tr>
<td>{{ task.code }}
<td>{{ task.name }}
<td>{{ task.sol_count }}
<td>{{ task.max_points|decimal|none_value('–') }}
<td>
{% if can_view_submits %}
<a class="btn btn-xs btn-success" href="{{ ctx.url_for('org_contest_task', task_id=task.task_id) }}">Odevzdaná řešení</a>
{% endif %}
{% if can_edit_points or can_create_solutions %}
<a class="btn btn-xs btn-default" href="{{ ctx.url_for('org_contest_task_edit', task_id=task.task_id) }}">{% if not can_edit_points %}Založit řešení{% else %}Zadat body{% endif %}</a>
{% endif %}
<td>
{% if can_view_submits %}
<a class="btn btn-xs btn-primary" href="{{ ctx.url_for('org_generic_batch_download', task_id=task.task_id) }}">Stáhnout ZIP</a>
{% endif %}
{% if can_upload %}
<a class='btn btn-xs btn-default' href="{{ ctx.url_for('org_generic_batch_upload', task_id=task.task_id) }}">Nahrát ZIP</a>
{% endif %}
{% if can_edit_points %}
<a class="btn btn-xs btn-default" href="{{ ctx.url_for('org_generic_batch_points', task_id=task.task_id) }}">Nahrát body</a>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% else %}
<p><i>Zatím nebyly přidány žádné úlohy.</i></p>
{% endif %}
<!--
Práva k {% if site %}soutěžními místu{% else %}soutěži{% endif %}:
{% if g.user.is_admin %}
admin
{% elif rights_list %}
{% for r in rights_list %}
{{ r.name }}
{% endfor %}
{% else %}
žádná
{% endif %}
-->
{% endblock %}