From e8fbdb2f32eecb36c2d2bbf14b265e26fe4b2f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Setni=C4=8Dka?= <setnicka@seznam.cz> Date: Sat, 9 Jan 2021 04:13:17 +0100 Subject: [PATCH] =?UTF-8?q?Rounds:=20tasks=5Ffile=20je=20NULL=20kdy=C5=BE?= =?UTF-8?q?=20nen=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zároveň kontrola stačí i bez 'is not None'. --- mo/db.py | 4 ++-- mo/web/org_round.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mo/db.py b/mo/db.py index e827ea09..b76a4c1d 100644 --- a/mo/db.py +++ b/mo/db.py @@ -208,8 +208,8 @@ class Round(Base): def task_statement_available(self) -> bool: # Zde jsme raději přepečliví... return (self.state != RoundState.preparing - and self.tasks_file is not None - and self.ct_tasks_start is not None + and self.tasks_file + and self.ct_tasks_start and mo.now >= self.ct_tasks_start) def ct_can_submit(self) -> bool: diff --git a/mo/web/org_round.py b/mo/web/org_round.py index 1980e6a4..86339bb2 100644 --- a/mo/web/org_round.py +++ b/mo/web/org_round.py @@ -250,7 +250,7 @@ class RoundEditForm(FlaskForm): state = wtforms.SelectField("Stav kola", choices=db.RoundState.choices(), coerce=db.RoundState.coerce) # Only the desktop Firefox does not support datetime-local field nowadays, # other browsers does provide date and time picker UI :( - tasks_file = wtforms.StringField("Soubor se zadáním", description="Cesta k ručně uploadovanému souboru") + tasks_file = wtforms.StringField("Soubor se zadáním", description="Cesta k ručně uploadovanému souboru", filters=[lambda x: x or None]) ct_tasks_start = DateTimeLocalField( "Čas zveřejnění úloh", validators=[validators.Optional()], description="Ve formátu 2020-01-01 00:00:00" -- GitLab