From d9449b6b588a35f54b61698de5f82ebde11af118 Mon Sep 17 00:00:00 2001 From: Nelson Elhage Date: Mon, 31 May 2010 20:54:47 -0400 Subject: [PATCH] AUTOPUNT --- render.py | 4 +-- templates/email.txt | 1 + templates/week.tmpl | 9 +++++++ weekly-update.py | 59 ++++++++++++++++++++++++++++++++++----------- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/render.py b/render.py index f226adb..cacd90d 100755 --- a/render.py +++ b/render.py @@ -33,7 +33,7 @@ def get_debts(): debts.append((user, val)) return debts -def render_template(path, week=None): +def render_template(path, week=None, **kwargs): with open('out/report.yml') as r: report = yaml.safe_load(r) @@ -93,7 +93,7 @@ def render_template(path, week=None): week=week, week_start=week_start,week_end=week_end, good=good, lame=lame, skip=skip, userlist=userlist, pool=get_balance('Pool'), paid=get_balance('Pool:Paid'), - debts=debts) + debts=debts, **kwargs) if __name__ == '__main__': if len(sys.argv) < 2: diff --git a/templates/email.txt b/templates/email.txt index d98a6b5..aaeff73 100644 --- a/templates/email.txt +++ b/templates/email.txt @@ -2,6 +2,7 @@ Subject: IRON BLOGGER results for the week beginning ${week_start.strftime("%F") To: iron-blogger@mit.edu SLACKERS: ${", ".join(sorted([u.username for u in lame]))} +PUNTED for balance greater than $30: ${", ".join(sorted(punt))} People who posted: % for u in sorted(good, key=lambda u:u.username): diff --git a/templates/week.tmpl b/templates/week.tmpl index d4ca365..0672bf4 100644 --- a/templates/week.tmpl +++ b/templates/week.tmpl @@ -20,6 +20,15 @@ Results for week beginning ${week_start.strftime("%F")} % endfor +% if punt: +

People punted for excessive outstanding balances:

+ +% endif + % if skip:

People who have not yet started