From 07f73e877578487735bf76ac58ecef7dcd6134f2 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Sat, 12 Apr 2025 20:57:22 +0200
Subject: [PATCH] =?UTF-8?q?Na=20str=C3=A1nce=20sout=C4=9B=C5=BEe=20ukazova?=
=?UTF-8?q?t=20po=C4=8Det=20sout=C4=9B=C5=BE=C3=ADc=C3=ADch=20+=20nesout?=
=?UTF-8?q?=C4=9B=C5=BE=C3=ADc=C3=ADch=20=C3=BA=C4=8Dastn=C3=ADk=C5=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #410.
---
mo/web/org_contest.py | 9 ++++++++-
mo/web/templates/org_contest.html | 5 ++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/mo/web/org_contest.py b/mo/web/org_contest.py
index 16ef2d33..a44370a0 100644
--- a/mo/web/org_contest.py
+++ b/mo/web/org_contest.py
@@ -472,13 +472,19 @@ def org_contest(ct_id: int, site_id: Optional[int] = None):
task.sol_count = sol_counts[task.task_id] if task.task_id in sol_counts else 0
places_counts = None
+ active_count = None
+ total_count = None
if not site_id:
places_counts = (
sess.query(db.Place, func.count('*'))
.select_from(db.Participation).join(db.Place)
.group_by(db.Place)
- .filter(db.Participation.contest == ctx.master_contest).all()
+ .filter(db.Participation.contest == ctx.master_contest)
+ .filter(db.Participation.state == db.PartState.active)
+ .all()
)
+ active_count = sum(pc[1] for pc in places_counts)
+ total_count = db.get_count(pions_subq)
group_contests = contest.get_group_contests(True)
group_contests.sort(key=lambda c: c.round.round_code())
@@ -491,6 +497,7 @@ def org_contest(ct_id: int, site_id: Optional[int] = None):
rights_list=sorted(rights.rights, key=lambda r: r.name),
roles=[r.friendly_name() for r in rights.get_roles()],
tasks=tasks, places_counts=places_counts,
+ active_count=active_count, total_count=total_count,
)
diff --git a/mo/web/templates/org_contest.html b/mo/web/templates/org_contest.html
index d30e80ef..48e9c197 100644
--- a/mo/web/templates/org_contest.html
+++ b/mo/web/templates/org_contest.html
@@ -135,7 +135,10 @@
<tfoot>
<tr>
<th>Celkem
- <th>{{ places_counts|sum(attribute=1) }}
+ <th>{{ active_count }}
+ {% if total_count > active_count %}
+ + {{ total_count - active_count }} nesoutěží
+ {% endif %}
<th>
</tr>
</tfoot>
--
GitLab