]> git.siccegge.de Git - teilnehmertool.git/blobdiff - teilnehmertool.py
Add helfercsv to strichliste
[teilnehmertool.git] / teilnehmertool.py
index d6bf8e2f2ecdc7cf92bdd541bfce891c3316f8aa..32967b7dcfed078e47ae3fea9026731e906d9b8c 100755 (executable)
@@ -199,15 +199,27 @@ def create_nametag(outdir='output'):
                                     uni1=hochschule.decode('utf-8')).encode('utf-8'))
 
 
-def create_teilnehmer_list(outdir = 'output'):
+def create_teilnehmer_list(outdir = 'output', only_quittung=False):
     template_full = env.get_template('teilnehmerliste.tex')
     template_pack = env.get_template('packliste.tex')
     template_quittung = env.get_template('quittung.tex')
+    template_strichliste = env.get_template('strichliste.tex')
+
+    if os.path.exists('helfer.csv'):
+        with open('helfer.csv', 'r') as csvfile:
+            csvreader = csv.DictReader(cvspath, delimiter=',', quotechar='"')
+            uni = "FAU Erlangen"
+
+            helfer = [ row['username'] for row in cvsreader ]
+    else:
+        print "Kein helfer.csv gefunden"
+        helfer = []
+
 
     i = 0
     teilnehmer = []
     for vor, nach, nick, hochschule, betrag, bezahlt, shirtsize, zippersize, dochned, comment in \
-        conn.execute("SELECT vorname, nachname, namensschild, hochschule, betrag, bezahlt, tshirt, zipper, dochned, orga_comment FROM teilnehmer ORDER BY UPPER(hochschule) ASC, UPPER(nachname) ASC"):
+        conn.execute("SELECT vorname, nachname, namensschild, hochschule, betrag, bezahlt, tshirt, zipper, dochned, orga_comment FROM teilnehmer ORDER BY UPPER(hochschule) ASC, UPPER(namensschild) ASC"):
 
         vor = vor.decode('utf8')
         nach = nach.decode('utf8')
@@ -237,11 +249,14 @@ def create_teilnehmer_list(outdir = 'output'):
             'will_attend': will_attend, 'comment': comment})
 
         if will_attend:
-            with open(os.path.join(outdir, ("%03d_quittung_%s_%s.tex" % (i, vor, nach))), 'w') as out:
-                out.write(template_quittung.render(vorname=vor, nachname=nach).encode('utf-8'))
+            with open(os.path.join(outdir, ("%03d_quittung_%s_%s.tex" % (i, vor.replace(" ", "_"), nach.replace(" ", "_")))), 'w') as out:
+                out.write(template_quittung.render(vorname=vor, nachname=nach, uni=hochschule).encode('utf-8'))
 
             i = i+1
 
+    ## gibt schlimmere hacks..
+    if only_quittung:
+        return
 
     with open(os.path.join(outdir, "teilnehmerliste.tex"), 'w') as out:
         out.write(template_full.render(teilnehmer=teilnehmer).encode('utf-8'))
@@ -249,6 +264,12 @@ def create_teilnehmer_list(outdir = 'output'):
     with open(os.path.join(outdir, "packliste.tex"), 'w') as out:
         out.write(template_pack.render(teilnehmer=teilnehmer).encode('utf-8'))
 
+    with open(os.path.join(outdir, "teilnehmer-strichliste.tex"), 'w') as out:
+        out.write(template_strichliste.render(teilnehmer=teilnehmer, helfer=helfer).encode('utf-8'))
+
+
+def create_teilnehmer_quittungen(output='quittungen'):
+    create_teilnehmer_list(output, only_quittung=True)
 
 
 def create_bmbf_list(outdir = 'output'):
@@ -257,13 +278,19 @@ def create_bmbf_list(outdir = 'output'):
 
     teilnehmer = []
     i = 1
-    for vor, nach, hochschule in \
-        conn.execute("SELECT vorname, nachname, hochschule FROM teilnehmer ORDER BY UPPER(nachname) ASC"):
+    for vor, nach, hochschule, dochned in \
+        conn.execute("SELECT vorname, nachname, hochschule, dochned FROM teilnehmer ORDER BY UPPER(nachname) ASC, UPPER (vorname) ASC"):
 
         vor = vor.decode('utf8')
         nach = nach.decode('utf8')
         hochschule = hochschule.decode('utf8')
 
+        if dochned != "false":
+            continue
+
+        if hochschule == "Privat" :
+            continue
+
         teilnehmer.append({'vorname': vor, 'nachname': nach, 'num': i, 'hochschule': hochschule})
         i = i+1