diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html
index 56d75675..63038aac 100644
--- a/seminar/templates/seminar/archiv/cislo.html
+++ b/seminar/templates/seminar/archiv/cislo.html
@@ -28,14 +28,15 @@
{% if user.is_staff %}
-
+
{% endif %}
{% if cislo.verejna_vysledkovka %}
@@ -61,7 +62,7 @@
{% for rv in vysledkovka %}
{% autoescape off %}{{ rv.poradi }}{% endautoescape %}
- |
+ |
{% if rv.titul %}
{{ rv.titul }}MM
{% endif %}
diff --git a/seminar/templates/seminar/archiv/cislo_obalkovani.html b/seminar/templates/seminar/archiv/cislo_obalkovani.html
new file mode 100644
index 00000000..dd0b0796
--- /dev/null
+++ b/seminar/templates/seminar/archiv/cislo_obalkovani.html
@@ -0,0 +1,33 @@
+{% extends "seminar/archiv/base.html" %}
+
+{% block content %}
+
+ {% block nadpis1a %}{% block nadpis1b %}
+ Obálkování {{ cislo }}
+ {% endblock %}{% endblock %}
+
+
+ Obálkovat se budou tyto problémy:
+
+ {% for p in problemy %}
+
+ - {{ p.kod_v_rocniku }} {{ p }}
+ {% endfor %}
+
+
+ {% for r in reseni %}
+ {% ifchanged r.resitel %}
+ {% if not forloop.first %}
+
+ {% endif %}
+ {{ r.resitel }}
+
+ {% endifchanged %}
+
+ -
+ {{ r.problem.kod_v_rocniku }} {{ r.problem.nazev }} ({{ r.body }})
+
+ {% endfor %}
+
+
+{% endblock content %}
diff --git a/seminar/templates/seminar/archiv/resitel_uloha.html b/seminar/templates/seminar/archiv/resitel_uloha.html
deleted file mode 100644
index f61ee704..00000000
--- a/seminar/templates/seminar/archiv/resitel_uloha.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-{% extends "seminar/archiv/base.html" %}
-
-{% block content %}
- K obálkování
-
-
- | Jméno |
-{% for u in ulohy %}
- {{u.nazev}}
-{% endfor %}
-
-{% for row in kdoco %}
- |
- {% for cell in row%}
- {{cell}} |
- {% endfor %}
-
-{% endfor %}
-
-{% endblock content %}
-
diff --git a/seminar/urls.py b/seminar/urls.py
index 446d6bc7..968e5f02 100644
--- a/seminar/urls.py
+++ b/seminar/urls.py
@@ -45,8 +45,8 @@ urlpatterns = [
staff_member_required(views.TitulyView), name='seminar_cislo_titul'),
url(r'^stav$',
staff_member_required(views.StavDatabazeView), name='stav_databaze'),
- url(r'^cislo/(?P\d+).(?P[0-9-]+)/resitel_uloha.html$',
- staff_member_required(views.resitelUlohaView), name='seminar_cislo_resitel_uloha'),
+ url(r'^cislo/(?P\d+).(?P[0-9-]+)/obalkovani$',
+ staff_member_required(views.obalkovaniView), name='seminar_cislo_resitel_obalkovani'),
url(r'^soustredeni/(?P\d+)/obalky.pdf',
staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'),
]
diff --git a/seminar/views.py b/seminar/views.py
index 4cd837b2..0f4c6e50 100644
--- a/seminar/views.py
+++ b/seminar/views.py
@@ -404,27 +404,15 @@ def obalkyView(request,resitele):
shutil.rmtree(tempdir)
return response
-def resitelUlohaView(request,rocnik,cislo):
+def obalkovaniView(request, rocnik, cislo):
rocnik = Rocnik.objects.get(rocnik=rocnik)
- cislo = Cislo.objects.get(rocnik=rocnik,cislo=cislo)
- reseni = Reseni.objects.filter(cislo_body=cislo).order_by('resitel')
- # TODO: Nasledujici 4 radky jsou fuj. Znate neco lepsiho?
- resitele = list(set([r.resitel for r in reseni]))
- resitele.sort(key=lambda r: (r.prijmeni,r.jmeno))
- ulohy = list(set([r.problem for r in reseni]))
- ulohy.sort(key=lambda u: (u.typ,u.kod))
-
- kdoco = []
- for r in resitele:
- res_ulohy = [r.jmeno+" "+r.prijmeni]
- for u in ulohy:
- try:
- rsni = reseni.get(resitel=r,problem=u)
- res_ulohy.append(rsni.body)
- except ObjectDoesNotExist:
- res_ulohy.append("")
- kdoco.append(res_ulohy)
- return render(request, 'seminar/archiv/resitel_uloha.html',{'ulohy':ulohy,'kdoco':kdoco})
+ cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo)
+
+ reseni = Reseni.objects.filter(cislo_body=cislo)
+ serazena_reseni = sorted(reseni, key=lambda r: (r.resitel.prijmeni, r.resitel.jmeno, r.problem.typ, r.problem.kod))
+
+ problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod))
+ return render(request, 'seminar/archiv/cislo_obalkovani.html', {'cislo': cislo, 'problemy': problemy, 'reseni': serazena_reseni})
### Tituly
|