Browse Source

Smazána složka /obalky, které se stejně nepoužívala

middleware_test
Pavel 'LEdoian' Turinsky 5 years ago
parent
commit
0f477c4ea4
  1. 1603
      obalky/lisak.eps
  2. 78
      obalky/obalky-template.tex
  3. 53
      obalky/obalky.py
  4. 26
      obalky/obalky.sql

1603
obalky/lisak.eps

File diff suppressed because it is too large

78
obalky/obalky-template.tex

@ -1,78 +0,0 @@
\input czech.sty
\input epsf
\special{landscape}
\nopagenumbers
\hoffset=-1in
\voffset=-1in
\advance\voffset by 0.9cm
%nove pridano, aby to fungovalo...
\advance\hoffset by 6.5cm
\hsize=22cm
\vsize=16cm
\font\adrfonta=csssbx10 at 14pt
\font\adrfontb=csssbx10 at 12pt
\font\adrfontc=csss12
\font\tofont=csr12 at 16pt
\newdimen\fromskip
\newdimen\toskip
\fromskip=4.35cm
\toskip=13.2cm
\def\first{\relax}
\catcode`_=13
%\catcode`_=12
\def_{$\_$}
\advance\voffset by 2.5cm
\def\obalka#1#2#3#4#5#6#7{
\def\jmeno{#1}
\def\prijm{#2}
\def\skola{#3}
\def\popis{}
\def\first{}
\def\ulice{#4}
\def\PSC{#5}
\def\mesto{#6}
\def\stat{#7}
\vskip-4mm\vbox to 0pt{\hbox to 0pt{\hskip1.4cm\epsfysize=2.55cm\epsfbox{lisak.eps}\hss}\vss}
\baselineskip=13pt
\parindent=\fromskip
\line{\indent\adrfonta Časopis M\&M,\hfil}
\vskip3pt
\line{\indent\adrfontb OPMK UK MFF\hfil}
\vskip3pt
\line{\indent\adrfontc Ke Karlovu 3, 121 16 Praha 2\hfil}
\line{\indent\adrfontc Tel.: +420 221 911 235\hss}
\line{\indent\adrfontc mam@atrey.karlin.mff.cuni.cz\hfil}
\vskip6.15cm
\vbox to 0pt{\parindent=1.4cm\hsize=\toskip\advance\hsize by -1cm
\vbox to 60pt{\vfil} \popis\vss}
\parindent=\toskip
\baselineskip=18pt
\line{\indent\tofont\first\hfil}
\line{\indent\tofont\jmeno\ \prijm\hfil}
\ifx \skola \empty
{}
\else
\line{\indent\tofont\skola\hfil}
\fi
\line{\indent\tofont\ulice\hfil}
\line{\tofont\item{\PSC} \mesto\hfil}
\vskip5pt
\line{\indent\tofont\stat\hfil}
\vfil\eject
}
%\obalka{Lenka}{Kopfová}{Leknínová 10}{746 01}{Opava}

53
obalky/obalky.py

@ -1,53 +0,0 @@
#!/usr/bin/python
#coding: utf-8
import psycopg2
import sys
import subprocess
import re
dbname="mam-prod"
user="mam"
conn = psycopg2.connect("dbname={0} user={1}".format(dbname,user))
cur = conn.cursor()
names = []
with open("obalky.sql") as qfile, open("obalky-template.tex") as texheader, open("obalky.tex","w") as texout :
texout.write(texheader.read())
cur.execute(qfile.read())
for row in cur.fetchall():
(muz,jmeno,prijmeni,skola,ulice,mesto,psc,stat)=row
if (stat=='CZ'):
stat = ""
elif (stat=='SK'):
stat = "Slovenská republika"
else:
print("Neznamy stat: {}\n".format(stat))
if (skola==None):
skola=""
psc = psc.replace(" ","")
psc = psc[0:3]+" "+psc[3:]
texout.write("\\obalka{{{0}}}{{{1}}}{{{2}}}{{{3}}}{{{4}}}{{{5}}}{{{6}}}\n".format(jmeno,prijmeni,skola,ulice,psc,mesto,stat))
names.append((jmeno,prijmeni))
texout.write("\\bye\n")
cur.close()
conn.close()
print("Spoustim csplain ...")
output = subprocess.check_output(["csplain","obalky.tex"],stderr=subprocess.STDOUT)
page = 0
for line in output.decode("utf-8").splitlines():
pmatch = re.search("\[([0-9]+)\]",line)
if pmatch:
page = int(pmatch.group(1))
errmatch = re.match("Overfull",line)
if errmatch:
print("Preteceni na strane",page,"u osoby",names[page][0],names[page][1])
print("Spoustim dvipdf ...")
subprocess.call(["dvipdf","obalky.dvi"])
print("Hotovo.")

26
obalky/obalky.sql

@ -1,26 +0,0 @@
WITH akt_rocnik AS (
SELECT rocnik FROM seminar_rocniky
WHERE id=(SELECT aktualni_rocnik_id FROM seminar_nastaveni)
), id_rocniku AS (
SELECT id,prvni_rok FROM seminar_rocniky
WHERE rocnik=(SELECT * FROM akt_rocnik) OR rocnik=(SELECT * FROM akt_rocnik)-1
), id_cisel AS (
SELECT seminar_cisla.id FROM seminar_cisla
INNER JOIN id_rocniku ON rocnik_id=id_rocniku.id
), problemy AS (
SELECT seminar_problemy.id FROM seminar_problemy
INNER JOIN id_cisel ON cislo_zadani_id = id_cisel.id
), resitele AS(
SELECT DISTINCT resitel_id FROM seminar_reseni
INNER JOIN problemy ON problem_id=problemy.id
)
SELECT pohlavi_muz,jmeno,prijmeni,NULL AS skola,ulice,mesto,psc,stat FROM seminar_resitele
INNER JOIN resitele ON seminar_resitele.id=resitel_id
WHERE zasilat='domu' AND rok_maturity > (SELECT MAX(prvni_rok) FROM id_rocniku)
UNION
SELECT res.pohlavi_muz,res.jmeno,res.prijmeni,sk.nazev,sk.ulice,sk.mesto,sk.psc,sk.stat
FROM seminar_resitele AS res
INNER JOIN resitele ON res.id=resitel_id
INNER JOIN seminar_skoly AS sk ON sk.id=skola_id
WHERE zasilat='do_skoly' AND rok_maturity > (SELECT MAX(prvni_rok) FROM id_rocniku)
ORDER BY prijmeni ASC, jmeno ASC
Loading…
Cancel
Save