Browse Source

Dokonceni generovani titulu, bugfixy

remotes/origin/imagekit
parent
commit
a40488a4c8
  1. 0
      seminar/templates/seminar/archiv/Tituly.tex
  2. 9
      seminar/templates/seminar/archiv/tituly.tex
  3. 27
      seminar/views.py

0
seminar/templates/seminar/archiv/Tituly.tex

9
seminar/templates/seminar/archiv/tituly.tex

@ -0,0 +1,9 @@
{% autoescape off %}
{% load tex %}
{% for r in resitele %}
{% spaceless %}
\def\{{r.ascii}}{\titul{{r.titul|sloz}}\relax}
{% endspaceless %}
{% endfor %}
{% endautoescape %}

27
seminar/views.py

@ -19,7 +19,7 @@ import subprocess
import shutil
import os
from django.conf import settings
import unicodedata
def verejna_temata(rocnik):
"""Vrací queryset zveřejněných témat v daném ročníku.
@ -350,13 +350,15 @@ def cisloObalkyView(request,rocnik,cislo):
letos = CisloObalkyStruct()
loni = CisloObalkyStruct()
letos.rocnik = Rocnik.objects.filter(rocnik = rocnik)
loni.rocnik = Rocnik.objects.filter(rocnik = int(rocnik)-1)
letos.rocnik = Rocnik.objects.filter(rocnik = rocnik)[0]
loni.rocnik = Rocnik.objects.filter(rocnik = int(rocnik)-1)[0]
letos.problemy = Problem.objects.filter(cislo_zadani = Cislo.objects.filter(rocnik=letos.rocnik,cislo__lte = cislo))
loni.problemy = Problem.objects.filter(cislo_zadani = Cislo.objects.filter(rocnik=loni.rocnik))
letos.resitele = Resitel.objects.filter(reseni = Reseni.objects.filter(problem=letos.problemy)).distinct()
loni.resitele = Resitel.objects.filter(reseni = Reseni.objects.filter(problem=loni.problemy)).distinct()
loni.resitele = loni.resitele.filter(rok_maturity__gt = letos.rocnik.prvni_rok)
if int(cislo) > 3:
resitele = letos.resitele
else:
@ -383,17 +385,20 @@ def obalkyView(request,resitele):
### Tituly
def TitulyView(request, rocnik, cislo):
resitele = Resitel.objects.all()
rocnik_obj = Rocnik.objects.filter(rocnik = rocnik).first()
resitele = Resitel.objects.filter(rok_maturity__gte = rocnik_obj.prvni_rok)
cislo_obj = Cislo.objects.filter(rocnik = rocnik_obj, cislo = cislo).first()
for resitel in resitele:
rocnik_obj = Rocnik.objects.filter(rocnik = rocnik)
cislo_obj = Cislo.objects.filter(rocnik = rocnik_obj, cislo = cislo).first()
body = VysledkyKCisluOdjakziva.objects.filter(resitel = resitel, cislo = cislo_obj).first().body
vys = VysledkyKCisluOdjakziva.objects.filter(resitel = resitele, cislo = cislo_obj).first()
if vys == None:
body = 0
else:
body = vys.body
resitel.titul = resitel.get_titul(body)
resitel.ascii = unicodedata.normalize('NFKD',resitel.jmeno+resitel.prijmeni).encode("ascii","ignore").replace(" ","")
return render(request, 'seminar/archiv/Tituly.tex',
{'resitele': resitele,
}
)
return render(request, 'seminar/archiv/tituly.tex',{'resitele': resitele})
### Soustredeni

Loading…
Cancel
Save