From: Christoph Egger Date: Wed, 18 Sep 2013 16:43:40 +0000 (+0200) Subject: Only generate confirmation email if amount payed changed compared to what we have... X-Git-Url: https://git.siccegge.de//index.cgi?p=teilnehmertool.git;a=commitdiff_plain;h=421348e62079c5bce5c343a34fb60d4a51b89895 Only generate confirmation email if amount payed changed compared to what we have in the database --- diff --git a/teilnehmertool.py b/teilnehmertool.py index b11b688..9ff5ca7 100755 --- a/teilnehmertool.py +++ b/teilnehmertool.py @@ -40,8 +40,14 @@ def mark_pay(outdir): if uid == "": break uid = int(uid) + vorname, nachname, email, bezahlt = \ + conn.execute("SELECT vorname, nachname, email, bezahlt FROM teilnehmer WHERE id = ?", [uid]).fetchone() + + if bezahlt > 20: + continue + conn.execute("UPDATE teilnehmer SET bezahlt = ? WHERE id = ?", [betrag, uid]) - vorname, nachname, email = conn.execute("SELECT vorname, nachname, email FROM teilnehmer WHERE id = ?", [uid]).fetchone() + with open(os.path.join(outdir, email), 'w') as f: f.write(template.render(vorname=vorname.decode('utf-8'),