Skip to content
Snippets Groups Projects
Commit b91d3072 authored by Jan Prachař's avatar Jan Prachař
Browse files

org_index: Stav i pro hierarchické odkazy

parent f20526c2
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ class OrgOverview: ...@@ -24,6 +24,7 @@ class OrgOverview:
role_list: List[db.RoleType] = field(default_factory=list) role_list: List[db.RoleType] = field(default_factory=list)
num_contests: int = 0 num_contests: int = 0
contest_states: Set[db.RoundState] = field(default_factory=set) contest_states: Set[db.RoundState] = field(default_factory=set)
lowest_state: db.RoundState = db.RoundState.closed
num_active_pants: int = 0 num_active_pants: int = 0
num_unconfirmed_pants: int = 0 num_unconfirmed_pants: int = 0
...@@ -113,6 +114,8 @@ def get_stats(overview: List[OrgOverview]) -> None: ...@@ -113,6 +114,8 @@ def get_stats(overview: List[OrgOverview]) -> None:
if o.contest: if o.contest:
o.num_contests = 1 o.num_contests = 1
o.contest_states.add(o.contest.state) o.contest_states.add(o.contest.state)
if o.contest.state > o.lowest_state:
o.lowest_state = o.contest.state
else: else:
rcs_for.append(rp) rcs_for.append(rp)
rps_for.append(rp) rps_for.append(rp)
...@@ -125,6 +128,8 @@ def get_stats(overview: List[OrgOverview]) -> None: ...@@ -125,6 +128,8 @@ def get_stats(overview: List[OrgOverview]) -> None:
o = over_by_round_place[(rcs.round_id, rcs.region)] o = over_by_round_place[(rcs.round_id, rcs.region)]
o.num_contests += rcs.count o.num_contests += rcs.count
o.contest_states.add(rcs.state) o.contest_states.add(rcs.state)
if rcs.state > o.lowest_state:
o.lowest_state = rcs.state
if rps_for: if rps_for:
rpss = (sess.query(db.RegionParticipantStat) rpss = (sess.query(db.RegionParticipantStat)
......
...@@ -31,12 +31,22 @@ ...@@ -31,12 +31,22 @@
{% set detail_url = url_for('org_round', round_id=o.round.round_id, hier_id=o.place.place_id) %} {% set detail_url = url_for('org_round', round_id=o.round.round_id, hier_id=o.place.place_id) %}
{% endif %} {% endif %}
<tr <tr
{% if o.contest %}
{% if o.contest.state == RoundState.preparing %} {% if o.contest.state == RoundState.preparing %}
class="warning" class="warning"
{% elif o.contest.state == RoundState.running %} {% elif o.contest.state == RoundState.running %}
class="success" class="success"
{% elif o.contest.state == RoundState.grading %} {% elif o.contest.state == RoundState.grading %}
class="info" class="info"
{% endif %}
{% else %}
{% if o.lowest_state == RoundState.preparing %}
class="warning"
{% elif o.lowest_state == RoundState.running %}
class="success"
{% elif o.lowest_state == RoundState.grading %}
class="info"
{% endif %}
{% endif %}> {% endif %}>
<td class="text-center"><b>{{ o.round.category }}</b> <td class="text-center"><b>{{ o.round.category }}</b>
<td>{{ o.round.name }} <td>{{ o.round.name }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment