From b9addf702041eeb21e9eff9e8612bc891aef7f10 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Thu, 25 Mar 2021 21:25:48 +0100
Subject: [PATCH] =?UTF-8?q?p-score:=20U=C5=BE=20um=C3=ADme=20d=C4=9Blen?=
 =?UTF-8?q?=C3=A1=20kola?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/p-score | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/p-score b/bin/p-score
index cd15d5ce..743f19a2 100755
--- a/bin/p-score
+++ b/bin/p-score
@@ -141,10 +141,11 @@ def write_html(round, tasks, contests, results):
             out.write(f'<tr><td colspan={num_cols}>\n\n')
 
 
-round = sess.query(db.Round).filter_by(year=args.year, category='P', seq=args.seq).one()
+round = sess.query(db.Round).filter_by(year=args.year, category='P', seq=args.seq).filter(db.Round.master_round_id == db.Round.round_id).one()
 print(f"Kolo {round.round_code()}")
 
-tasks = sess.query(db.Task).filter_by(round=round).order_by(db.Task.code).all()
+round_group_subq = sess.query(db.Round.round_id).filter_by(master_round_id=round.round_id).subquery()
+tasks = sess.query(db.Task).filter(db.Task.round_id.in_(round_group_subq)).order_by(db.Task.code).all()
 
 contests = (sess.query(db.Contest)
             .filter_by(round=round)
-- 
GitLab