diff --git a/mo/web/org_round.py b/mo/web/org_round.py index 7f5031137d6a724fcf53cd432454090829eb2378..96b94c61c878b66ee0b828bd20545aaa07261e87 100644 --- a/mo/web/org_round.py +++ b/mo/web/org_round.py @@ -445,6 +445,11 @@ def org_round_edit(id: int): round, _, rr = get_round_rr(id, Right.manage_round, True) form = RoundEditForm(obj=round) + if round.is_subround(): + # podkolo nemá nastavení výsledkové listiny + del form.score_mode + del form.score_winner_limit + del form.score_successful_limit if form.validate_on_submit(): form.populate_obj(round) diff --git a/mo/web/org_score.py b/mo/web/org_score.py index a648bc74e98e2f50593d1fdacc1ed8123bef47b2..cbebbcda83cdf883faccb1a583864d98a2ac1204 100644 --- a/mo/web/org_score.py +++ b/mo/web/org_score.py @@ -1,6 +1,7 @@ from flask import render_template, request, g from flask.helpers import url_for from typing import List, Optional, Union +from sqlalchemy.orm import joinedload import werkzeug.exceptions import mo @@ -83,12 +84,16 @@ def org_score(round_id: Optional[int] = None, contest_id: Optional[int] = None): sess = db.get_session() if round_id: contest = None - round = sess.query(db.Round).get(round_id) + round = sess.query(db.Round).options( + joinedload(db.Round.master) + ).get(round_id) if not round: raise werkzeug.exceptions.NotFound() rr = g.gatekeeper.rights_for_round(round, True) else: - contest = sess.query(db.Contest).get(contest_id) + contest = sess.query(db.Contest).options( + joinedload(db.Contest.round).joinedload(db.Round.master) + ).get(contest_id) if not contest: raise werkzeug.exceptions.NotFound() round = contest.round @@ -97,7 +102,7 @@ def org_score(round_id: Optional[int] = None, contest_id: Optional[int] = None): if not rr.have_right(Right.view_submits): raise werkzeug.exceptions.Forbidden() - score = Score(round, contest) + score = Score(round.master, contest) tasks = score.get_tasks() results = score.get_sorted_results() messages = score.get_messages() diff --git a/mo/web/templates/org_round.html b/mo/web/templates/org_round.html index 6c5705dc35258985d0b6b711ac38ae08ee7e4e2e..aa1a62a677497f02ed0459b0d5b7c2edb15e8b05 100644 --- a/mo/web/templates/org_round.html +++ b/mo/web/templates/org_round.html @@ -8,7 +8,10 @@ {% block body %} -<table class=data> +<table class=data style="float: left; margin-right: 10px;"> + <thead> + <tr><th colspan=2>Parametry kola <i>(nelze editovat)</i> + </thead> <tr><td>Ročník<td>{{ round.year }} <tr><td>Kategorie<td>{{ round.category }} <tr><td>Pořadí<td>{{ round.seq }} @@ -23,11 +26,19 @@ {% endif %} {% endfor %} {% endif %} + <thead> + <tr><th colspan=2>Základní nastavení + </thead> <tr><td>Název<td>{{ round.name }} <tr><td>Stav<td class='rstate-{{round.state.name}}'>{{ round.state.friendly_name() }} {% with state=round.ct_state() %} <tr><td>Stav pro účastníky<td class='rstate-{{state.name}}'>{{ state.friendly_name() }} {% endwith %} +</table> +<table class=data style="float: left;"> + <thead> + <tr><th colspan=2>Termíny + </thead> <tr><td>Účastníci vidí zadání od<td>{{ round.ct_tasks_start|time_and_timedelta }} <tr><td>Účastníci odevzdávají do<td>{{ round.ct_submit_end|time_and_timedelta }} <tr><td>Dozor vidí zadání od<td>{{ round.pr_tasks_start|time_and_timedelta }} @@ -42,10 +53,16 @@ {% else %} – {% endif %} - <tr><td>Výsledková listina<td>{{ round.score_mode.friendly_name() }} - <tr><td>Hranice bodů pro vítěze<td>{{ round.score_winner_limit|none_value(Markup('<i>nenastaveno</i>')) }} - <tr><td>Hranice bodů pro úspěšné řešitele<td>{{ round.score_successful_limit|none_value(Markup('<i>nenastaveno</i>')) }} + <thead> + <tr><th colspan=2>Nastavení výsledkové listiny{% if round.is_subround() %} + <i>(přejato z <a href="{{ url_for('org_round', id=round.master.round_id) }}">{{ round.master.round_code() }}</a>)</i> + {% endif %} + </thead> + <tr><td>Výsledková listina<td>{{ round.master.score_mode.friendly_name() }} + <tr><td>Hranice bodů pro vítěze<td>{{ round.master.score_winner_limit|none_value(Markup('<i>nenastaveno</i>')) }} + <tr><td>Hranice bodů pro úspěšné řešitele<td>{{ round.master.score_successful_limit|none_value(Markup('<i>nenastaveno</i>')) }} </table> +<div style="clear: both;"></div> <div class="btn-group"> <a class="btn btn-primary" href='{{ url_for('org_round_list', id=round.round_id) }}'>Seznam účastníků</a> @@ -56,7 +73,7 @@ <a class="btn btn-default" href='{{ url_for('org_round_import', id=round.round_id) }}'>Importovat data</a> {% endif %} {% if can_manage_round %} - <a class="btn btn-default" href='{{ url_for('org_round_edit', id=round.round_id) }}'>Editovat nastavení kola</a> + <a class="btn btn-default" href='{{ url_for('org_round_edit', id=round.round_id) }}'>Editovat nastavení a termíny</a> {% endif %} {% if round.has_messages %} <a class="btn btn-default" href='{{ url_for('org_round_messages', id=round.round_id) }}'>Zprávičky</a> diff --git a/mo/web/templates/org_score.html b/mo/web/templates/org_score.html index 6cf67c92b7e0d605b74b02d3f7b9816d232aa9f8..21740346c8516b19cb4868f69edb124a0b5cbc34 100644 --- a/mo/web/templates/org_score.html +++ b/mo/web/templates/org_score.html @@ -46,18 +46,19 @@ Jsou v ní započítány body ze všech úloh těchto kol.</p> {% endif %} -<p>Mód této výsledkové listiny je <b>{{ round.score_mode.friendly_name() }}</b>. +{% set master = round.master %} +<p>Mód této výsledkové listiny je <b>{{ master.score_mode.friendly_name() }}</b>. Diskvalifikovaní, odmítnuvší a nepřítomní účastníci jsou skryti, stejně tak testovací uživatelé. Export pod tabulkou obsahuje sloupce navíc. Rozkliknutím bodů se lze dostat na detail daného řešení.</p> -{% if round.score_winner_limit is not none or round.score_successful_limit is not none %} +{% if master.score_winner_limit is not none or master.score_successful_limit is not none %} <p> -{% if round.score_winner_limit is not none %} -<b>Vítězi</b> se stávají účastníci s alespoň <b>{{ round.score_winner_limit|inflected("bodem", "body", "body") }}</b>. +{% if master.score_winner_limit is not none %} +<b>Vítězi</b> se stávají účastníci s alespoň <b>{{ master.score_winner_limit|inflected("bodem", "body", "body") }}</b>. {% endif %} -{% if round.score_successful_limit is not none %} -<b>Úspěšnými řešiteli</b> se stávají účastníci s alespoň <b>{{ round.score_successful_limit|inflected("bodem", "body", "body") }}</b>. +{% if master.score_successful_limit is not none %} +<b>Úspěšnými řešiteli</b> se stávají účastníci s alespoň <b>{{ master.score_successful_limit|inflected("bodem", "body", "body") }}</b>. {% endif %} {% endif %}