From 3298e112d890cb4eea42b1e1dca6f2812c4b0368 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Sat, 2 Oct 2021 00:04:15 +0200
Subject: [PATCH] =?UTF-8?q?=C3=9A=C4=8Dastn=C3=ADci=20vid=C3=AD=20zad?=
 =?UTF-8?q?=C3=A1n=C3=AD=20a=20novinky,=20by=C5=A5=20je=C5=A1t=C4=9B=20nem?=
 =?UTF-8?q?aj=C3=AD=20potvrzenou=20p=C5=99ihl=C3=A1=C5=A1ku?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 mo/web/user.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mo/web/user.py b/mo/web/user.py
index 9ff741ec..65cd3c86 100644
--- a/mo/web/user.py
+++ b/mo/web/user.py
@@ -269,8 +269,8 @@ def get_contest_pion(id: int, require_reg: bool = True) -> Tuple[db.Contest, db.
     return contest, pion
 
 
-def get_contest(id: int) -> db.Contest:
-    contest, _ = get_contest_pion(id)
+def get_contest(id: int, require_reg: bool = True) -> db.Contest:
+    contest, _ = get_contest_pion(id, require_reg)
     return contest
 
 
@@ -313,7 +313,7 @@ def user_contest(id: int):
 @app.route('/user/contest/<int:id>/news')
 def user_contest_news(id: int):
     sess = db.get_session()
-    contest = get_contest(id)
+    contest = get_contest(id, require_reg=False)
 
     messages = sess.query(db.Message).filter_by(round_id=contest.round_id).order_by(db.Message.created_at).all()
 
@@ -328,7 +328,7 @@ def user_contest_news(id: int):
 
 @app.route('/user/contest/<int:id>/task-statement/zadani.pdf')
 def user_task_statement(id: int):
-    contest = get_contest(id)
+    contest = get_contest(id, require_reg=False)
 
     if not contest.ct_task_statement_available():
         logger.warn(f'Účastník #{g.user.user_id} chce zadání, na které nemá právo')
-- 
GitLab