From b94af4ca3372fa4786b6fa250a0195520c0d797f Mon Sep 17 00:00:00 2001 From: Johannes Schilling Date: Sun, 27 Oct 2013 14:17:28 +0100 Subject: [PATCH] schaun ob abgemeldet im create_nametag --- teilnehmertool.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/teilnehmertool.py b/teilnehmertool.py index d80d2a1..bda2774 100755 --- a/teilnehmertool.py +++ b/teilnehmertool.py @@ -10,6 +10,7 @@ import jinja2 import os import os.path import re +import sys conn = None @@ -46,8 +47,8 @@ def import_teilnehmer(input): continue if not int(row[0]) in ids: print "Importing %s" % (row, ) - conn.execute("INSERT INTO teilnehmer VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", - row[:-2] + ['Kein T-Shirt', 'Kein Pulli'] + row[-2:] + [0, 0, 0]) + conn.execute("INSERT INTO teilnehmer VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + row[:-2] + ['Kein T-Shirt', 'Kein Pulli'] + row[-2:] + [0, 0, 0, "", "false"]) conn.commit() @@ -150,21 +151,24 @@ def create_remind(outdir='output'): preis, id]) conn.commit() + def create_nametag(outdir='output'): template = env.get_template('nametag.svg') - for vorname, nachname, namensschild, hochschule in \ - conn.execute("SELECT vorname, nachname, namensschild, hochschule FROM teilnehmer"): + for teiln_id, vorname, nachname, namensschild, hochschule, dochned in \ + conn.execute("SELECT id, vorname, nachname, namensschild, hochschule, dochned FROM teilnehmer"): + + if dochned != "false": + print >> sys.stderr, "not generating %s %s (id %s), because abgemeldet" % (vorname, nachname, teiln_id) + continue - with open(os.path.join(outdir, "%s.svg" % namensschild), 'w') as f: + with open(os.path.join(outdir, "%s.svg" % teiln_id), 'w') as f: f.write(template.render(name=u"%s %s" % (vorname.decode('utf-8'), nachname.decode('utf-8')), nick=namensschild.decode('utf-8'), uni1=hochschule.decode('utf-8')).encode('utf-8')) -## TODO: feld 'comments', alle abgemeldeten checken und eintragen, -## nicht-tüter, nicht-XYer.. def create_teilnehmer_list(outdir = 'output'): template = env.get_template('teilnehmerliste.tex') -- 2.39.2