From f5c4d693e357c0d34ce83873d59c8d5ff06bcd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Mon, 7 Sep 2015 16:45:29 +0200 Subject: [PATCH] =?UTF-8?q?=C4=8C=C3=ADslo:=20=C5=99a=C4=8F=20probl=C3=A9m?= =?UTF-8?q?y=20dle=20k=C3=B3du,=20zobraz=20jen=20skute=C4=8Dn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a ne ty umělé typu konfera --- seminar/templates/seminar/archiv/cislo.html | 4 ++-- seminar/views.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index 02b6f6f8..b7b11a1c 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -8,14 +8,14 @@

Zadané problémy

Řešené problémy

diff --git a/seminar/views.py b/seminar/views.py index 0a3d286e..cae3be45 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -186,6 +186,12 @@ class CisloView(generic.DetailView): vysledky = VysledkyKCisluZaRocnik.objects.filter(cislo = context['cislo']).order_by('-body', 'resitel__prijmeni', 'resitel__jmeno') reseni = Reseni.objects.filter(cislo_body = context['cislo']).select_related("resitel") + # typy úloh, které se mají zobrazovat u čísla, tj. těch, které byly v čísle skutečně zadány + typy_skutecne_zadanych = [Problem.TYP_ULOHA, Problem.TYP_SERIAL, Problem.TYP_ORG_CLANEK] + v_cisle_zadane = Problem.objects.filter(cislo_zadani=context['cislo']).filter(typ__in=typy_skutecne_zadanych).order_by('cislo_reseni__cislo', 'kod') + + resene_problemy = Problem.objects.filter(cislo_reseni=context['cislo']).filter(typ__in=typy_skutecne_zadanych).order_by('cislo_reseni__cislo', 'kod') + problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1,x.kod)) #setridi problemy podle typu a poradi zadani problem_index = {} @@ -250,6 +256,8 @@ class CisloView(generic.DetailView): context['vysledkovka'] = vysledkovka context['problemy'] = problemy + context['v_cisle_zadane'] = v_cisle_zadane + context['resene_problemy'] = resene_problemy return context ### Generovani vysledkovky