From abc479b5493c1cb197f51a2cea571b154e846aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 29 Nov 2021 23:46:30 +0100 Subject: [PATCH] =?UTF-8?q?Se=C5=99azen=C3=AD=20podprobl=C3=A9m=C5=AF=20po?= =?UTF-8?q?dle=20k=C3=B3du=20m=C3=ADsto=20podle=20jm=C3=A9na?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/seminar/utils.py b/seminar/utils.py index 9bca3c37..176831cb 100644 --- a/seminar/utils.py +++ b/seminar/utils.py @@ -310,7 +310,13 @@ def podproblemy_v_cislu(cislo, problemy=None, hlavni_problemy=None): podproblemy[-1].append(problem) for podproblem in podproblemy.keys(): - podproblemy[podproblem] = sorted(podproblemy[podproblem], key=lambda it: it.kod) + def int_or_zero(p): + try: + return int(p.kod) + except ValueError: + return 0 + + podproblemy[podproblem] = sorted(podproblemy[podproblem], key=int_or_zero) return podproblemy