From 88860632380c77c29c70aac0a31aef483d38957b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pracha=C5=99?= <jan.prachar@gmail.com>
Date: Fri, 5 Mar 2021 22:28:33 +0100
Subject: [PATCH] =?UTF-8?q?Oprava=20nekonzistence=20mezi=20seznamem=20?=
 =?UTF-8?q?=C3=BA=C4=8Dastn=C3=ADk=C5=AF=20kola=20a=20sout=C4=9B=C5=BEe?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 mo/web/org_round.py                  | 15 +++++++++------
 mo/web/templates/org_round_list.html |  3 ---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/mo/web/org_round.py b/mo/web/org_round.py
index b6665096..428e5685 100644
--- a/mo/web/org_round.py
+++ b/mo/web/org_round.py
@@ -301,7 +301,8 @@ def org_round_task_batch_points(round_id: int, task_id: int):
 
 @app.route('/org/contest/r/<int:id>/list', methods=('GET', 'POST'))
 def org_round_list(id: int):
-    round, rr = get_round_rr(id, Right.manage_contest, True)
+    round, rr = get_round_rr(id, None, True)
+    can_edit = rr.have_right(Right.manage_contest)
     format = request.args.get('format', "")
 
     filter = ParticipantsFilterForm(request.args)
@@ -314,16 +315,18 @@ def org_round_list(id: int):
         participation_state=filter.f_participation_state,
     )
 
-    action_form = ParticipantsActionForm()
-    if action_form.do_action(round=round, query=query):
-        # Action happened, redirect
-        return redirect(request.url)
+    action_form = None
+    if can_edit:
+        action_form = ParticipantsActionForm()
+        if action_form.do_action(round=round, query=query):
+            # Action happened, redirect
+            return redirect(request.url)
 
     if format == "":
         (count, query) = filter.apply_limits(query, pagesize=50)
         # count = db.get_count(query)
 
-        table = make_contestant_table(query, add_contest_column=True, add_checkbox=True)
+        table = make_contestant_table(query, add_contest_column=True, add_checkbox=can_edit)
         return render_template(
             'org_round_list.html',
             round=round,
diff --git a/mo/web/templates/org_round_list.html b/mo/web/templates/org_round_list.html
index 417006a9..18105a9b 100644
--- a/mo/web/templates/org_round_list.html
+++ b/mo/web/templates/org_round_list.html
@@ -47,7 +47,4 @@
 
 {% include 'parts/org_participants_table_actions.html' %}
 
-<br>
-<i>Upozornění: Můžete editovat jen účastníky soutěžící v oblastech, ke kterým máte právo.</i>
-
 {% endblock %}
-- 
GitLab