Compare commits
	
		
			3 commits
		
	
	
		
			certifikat
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 51c08b6043 | ||
| 942e01f767 | |||
| e8c5141408 | 
					 9 changed files with 18 additions and 133 deletions
				
			
		|  | @ -91,7 +91,7 @@ TODO: tabulka není úplná. Pokud na něco narazíte, tak ji prosím doplňte. | |||
| 
 | ||||
|    Ubuntu 22.10, ??, ``python3-venv``, ``python3-dev``, ``libpq-dev``, "Je potřeba zapnout zdroj ``universe`` a nainstalovat kompilátor C (``gcc``)?" | ||||
|    Linux Mint 21, ??, ``python3-venv``, ``python3-dev``, ``libpq-dev``, "" | ||||
|    Archlinux 2022.11.01, AUR, vestavěný, vestavěné, ``postgresql-libs``, "Je potřeba céčkový kompilátor (``gcc``)" | ||||
|    Archlinux 2022.11.01, AUR, vestavěný, vestavěné, ``postgresql-libs``, "Je potřeba céčkový kompilátor (``gcc``); nezapomenout vygenerovat locale ``cs_CZ.UTF-8``" | ||||
|    openSUSE Leap 15.4, oficiální (``python39``), předinstalovaný?, ``python39-devel``, ??FIXME!!, "Výchozí verze pythonu je 3.6 a ta je moc stará, potřeba instalovat ``gcc``. Nevím jak sehnat pg_config." | ||||
|    Debian 11, "oficiální, výchozí", ??, ??, ??, "Určitě to tam rozběhat jde, protože Gimli. Nejspíš bude relativně podobné Ubuntu." | ||||
| 
 | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -122,7 +122,6 @@ | |||
|     <p><a href="tituly.tex" download>Tituly (TeX, včetně neveřejných, všechny, nevhodné do mamtexu)</a></p> | ||||
|     {# FIXME: Sice to sem asi nepatří sémanticky, ale bylo to nejjednodušší… #} | ||||
|     <p><a href='{% url 'tvorba_rocnik_resitele_csv' rocnik=rocnik.rocnik %}' download>CSV export řešitelů</a></p> | ||||
|     <p><a href='certifikaty.tar.gz' download>Certifikáty úspěšných řešitelů (doplňte místa [a data] narození a zkompilujte ./certifikaty)</a></p> | ||||
|     <h2>Výsledková listina včetně neveřejných bodů</h2> | ||||
|         {% include "vysledkovky/vysledkovka_rocnik.html" with vysledkovka=vysledkovka_neverejna %} | ||||
|     </div> | ||||
|  |  | |||
|  | @ -1,11 +0,0 @@ | |||
| {% autoescape off %}{% load static %}{% load tex %}{% with lb='{' %} | ||||
| \def\ucastnik{{resitel|sloz}} | ||||
| \def\narozeni{{lb}} {% firstof ofresitel.osoba.datum_narozeni "\\TODO{datum narození ve tvaru 1. 1. 2001}" %}} | ||||
| \def\mistonar{\TODO{místo narození}} | ||||
| \def\body{{lb}}{{body}} bod{% if cele %}ů{% else %}u{% endif %}} | ||||
| 
 | ||||
| \newif\ifresitelka | ||||
| {% if osloveni_zenske %}\resitelkatrue{% else %}\resitelkafalse{% endif %} | ||||
| 
 | ||||
| \input{certifikat.tex} | ||||
| {% endwith %}{% endautoescape %} | ||||
|  | @ -1,65 +0,0 @@ | |||
| {% autoescape off %}{% load static %}{% load tex %}{% with lb='{' %} | ||||
| \def\rocnik{{rocnik.rocnik|sloz}} | ||||
| \def\rok{{lb}}{{rocnik.prvni_rok}}/{{rocnik.prvni_rok|add:"1"}}} | ||||
| 
 | ||||
| \def\levypodpis{Mgr. Vladan Majerech, Dr.\\vedoucí KS M\&M} | ||||
| \def\pravypodpis{doc. RNDr. Mirko Rokyta, CSc.\\děkan MFF UK} | ||||
| 
 | ||||
| 
 | ||||
| \documentclass[landscape, 12pt]{article} | ||||
| 
 | ||||
| \usepackage{geometry}\geometry{a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm} | ||||
| \setlength\parskip{2em} | ||||
| \pagestyle{empty} | ||||
| \usepackage{graphicx} | ||||
| \usepackage[czech]{babel} | ||||
| 
 | ||||
| \begin{document} | ||||
|     \centering | ||||
|     \Large | ||||
| 
 | ||||
|     {\Huge | ||||
|     \includegraphics[width=0.45\textwidth]{mff-uk-logo.pdf}\\[1em] | ||||
|     uděluje osvědčení úspěšného řešitele\\ | ||||
|     Korespondenčního semináře M\&M | ||||
|     \par} | ||||
| 
 | ||||
|     {\normalsize jméno účastn\ifresitelka ice\else íka\fi:} {\Huge \ucastnik}\\ | ||||
|     {\normalsize datum narození:} \narozeni{\normalsize, místo narození:} \mistonar | ||||
| 
 | ||||
|     Účastn\ifresitelka ice\else ík\fi\ v \rocnik. ročníku semináře (školní rok \rok) získal\ifresitelka a\fi\ \body,\\ | ||||
|     čímž se stal\ifresitelka a\fi\ úspěšným řešitelem korespondenčního semináře. | ||||
| 
 | ||||
|     \begin{minipage}[t]{0.25\textwidth} | ||||
|     { | ||||
|         \centering | ||||
|         \hrule | ||||
|         \vspace{4pt} | ||||
|         \normalsize\levypodpis | ||||
|         \par | ||||
|     } | ||||
|     \end{minipage} | ||||
|     \begin{minipage}[b]{0.3\textwidth} | ||||
|         \centering | ||||
|         \includegraphics[width=0.8\textwidth]{logomm-new.pdf} | ||||
|         \par | ||||
|     \end{minipage} | ||||
|     \begin{minipage}[t]{0.25\textwidth} | ||||
|     { | ||||
|         \centering | ||||
|         \hrule | ||||
|         \vspace{4pt} | ||||
|         \normalsize\pravypodpis | ||||
|         \par | ||||
|     } | ||||
|     \end{minipage} | ||||
| 
 | ||||
|     \vspace{1em} | ||||
| 
 | ||||
|     %{\vbox to 0pt{\hbox to \textwidth{\hfill\includegraphics[height=2.5em]{jcmf.pdf}}\vskip 0pt minus 1fill}\setlength\parskip{0pt}\noindent} | ||||
|     {\normalsize | ||||
|     Korespondenční seminář M\&M organizují převážně studenti Matematicko-fyzikální fakulty Univerzity Karlovy.\\ | ||||
|     %	Organizaci semináře a vydávání časopisu podporuje Jednota českých matematiků a fyziků. | ||||
|     \par} | ||||
| \end{document} | ||||
| {% endwith %}{% endautoescape %} | ||||
|  | @ -12,6 +12,22 @@ POZOR! Kolize jmen! Dva řešitelé mají stejné makro! | |||
| {% autoescape off %} | ||||
| {% load tex %} | ||||
| 
 | ||||
| \ExplSyntaxOn | ||||
| \char_set_catcode_other:n{32}% Odsud dál do \char_set_catcode_space:n{32} nesmí být za žádnou cenu jiná mezera (tj. i zlom řádku) než ty mezi jménem a příjmením | ||||
| \prop_const_from_keyval:Nn\g_tituly% | ||||
| {% | ||||
| {% for r in resitele %}{{r|sloz}}={% if r.titul == '' %}{}{% else %}{\titul{{r.titul|sloz}}}{% endif %},% | ||||
| {% endfor %}}% | ||||
| \char_set_catcode_space:n{32} | ||||
| 
 | ||||
| \DeclareDocumentCommand\Titul{mO{#1}}{% | ||||
| \prop_if_in:NnTF\g_tituly{#1}% | ||||
| {\prop_item:Nn\g_tituly{#1}}% | ||||
| {\ClassError{mam}{Titul pro #1 nenalezen!}{}}% | ||||
| #2% | ||||
| } | ||||
| \ExplSyntaxOff | ||||
| 
 | ||||
| {% for r in resitele %} | ||||
|   {% if r.titul == '' %} | ||||
|   	{% spaceless %} | ||||
|  |  | |||
|  | @ -36,11 +36,6 @@ urlpatterns = [ | |||
| 		org_required(views.resiteleRocnikuCsvExportView), | ||||
| 		name='tvorba_rocnik_resitele_csv' | ||||
| 	), | ||||
| 	path( | ||||
| 		'rocnik/<int:rocnik>/certifikaty.tar.gz', | ||||
| 		org_required(views.certifikatyExportView), | ||||
| 		name='tvorba_rocnik_certifikaty' | ||||
| 	), | ||||
| 	path( | ||||
| 		'rocnik/<int:rocnik>/tituly.tex', | ||||
| 		org_required(views.TitulyViewRocnik), | ||||
|  |  | |||
|  | @ -13,9 +13,8 @@ from django.http import Http404 | |||
| from django.db.models import Q, Sum, Count | ||||
| from django.views.generic.base import RedirectView | ||||
| from django.core.exceptions import PermissionDenied | ||||
| from django.contrib.staticfiles.finders import find | ||||
| 
 | ||||
| from personalni.models import Resitel, Osoba | ||||
| from personalni.models import Resitel | ||||
| from soustredeni.models import Konfera | ||||
| from tvorba.models import Problem, Cislo, Rocnik, Tema, Clanek, Deadline, Uloha | ||||
| from treenode.models import TemaVCisleNode, PohadkaNode | ||||
|  | @ -35,10 +34,6 @@ from django.conf import settings | |||
| import unicodedata | ||||
| import logging | ||||
| import time | ||||
| import http | ||||
| import tempfile | ||||
| import shutil | ||||
| import subprocess | ||||
| 
 | ||||
| import personalni.views | ||||
| 
 | ||||
|  | @ -286,50 +281,6 @@ def resiteleRocnikuCsvExportView(request, rocnik): | |||
| 		) | ||||
| 	) | ||||
| 
 | ||||
| def certifikatyExportView(request, rocnik): | ||||
| 	rocnik = get_object_or_404(Rocnik, rocnik=rocnik) | ||||
| 	id_a_body_resitelu: dict[int, int] = body_resitelu( | ||||
| 		rocnik, | ||||
| 		jen_verejne = False, | ||||
| 	) | ||||
| 	resitele_a_body = [(Resitel.objects.get(id=id), body) for id, body in id_a_body_resitelu.items() if body > 100] | ||||
| 
 | ||||
| 	with tempfile.TemporaryDirectory() as tempdir: | ||||
| 		shutil.copy(find("tvorba/logomm-new.pdf"), tempdir) | ||||
| 		shutil.copy(find("tvorba/mff-uk-logo.pdf"), tempdir) | ||||
| 		tex = render(request, "tvorba/archiv/rocnik_certifikat_part.tex", { | ||||
| 			"rocnik": rocnik, | ||||
| 		}).content | ||||
| 		with open(tempdir+"/certifikat.tex", "w") as texfile: | ||||
| 			texfile.write(tex.decode()) | ||||
| 
 | ||||
| 		ostatni_soubory = ["logomm-new.pdf", "mff-uk-logo.pdf", "certifikat.tex"] | ||||
| 
 | ||||
| 		certifikaty = [] | ||||
| 		for r, b in resitele_a_body: | ||||
| 			tex = render(request, "tvorba/archiv/rocnik_certifikat.tex", { | ||||
| 				"resitel": r, | ||||
| 				"body": b, | ||||
| 				"cele": b % 1 == 0, | ||||
| 				"osloveni_zenske": r.osoba.osloveni == Osoba.OSLOVENI_ZENSKE, | ||||
| 			}).content | ||||
| 
 | ||||
| 			soubor = f"{r}.tex" | ||||
| 			with open(f"{tempdir}/{soubor}", "w") as texfile: | ||||
| 				texfile.write(tex.decode()) | ||||
| 			certifikaty.append(soubor) | ||||
| 
 | ||||
| 		with open(tempdir+"/certifikaty", "w") as skript: | ||||
| 			for certifikat in certifikaty: | ||||
| 				print(f"pdflatex '{certifikat}'", file=skript) | ||||
| 		os.chmod(f"{tempdir}/certifikaty", 0o777) | ||||
| 
 | ||||
| 		subprocess.call(["tar", "-czf", "certifikaty.tar.gz", *certifikaty, *ostatni_soubory, "certifikaty"], cwd=tempdir) | ||||
| 		with open(tempdir+"/certifikaty.tar.gz", "rb") as pdffile: | ||||
| 			response = HttpResponse(pdffile.read(), content_type='application/gzip') | ||||
| 	return response | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| # FIXME: Pozor, výš je ještě jeden ProblemView! | ||||
| #class ProblemView(generic.DetailView): | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue