added code from mako hill to list folks who have previously been punted to the weekly update
added punt listing to the quick view replaced two tabs with spaces in render.py
This commit is contained in:
parent
0509329698
commit
cf11d9f4d8
12
render.py
12
render.py
|
@ -22,9 +22,9 @@ def get_balance(acct):
|
|||
stdout=subprocess.PIPE)
|
||||
(out, _) = p.communicate()
|
||||
try:
|
||||
return int(out.split()[0][1:])
|
||||
return int(out.split()[0][1:])
|
||||
except:
|
||||
return 0
|
||||
return 0
|
||||
|
||||
def get_debts():
|
||||
p = subprocess.Popen(['ledger', '-f', os.path.join(HERE, 'ledger'),
|
||||
|
@ -80,6 +80,7 @@ def render_template(path, week=None, **kwargs):
|
|||
lame = []
|
||||
skip = []
|
||||
userlist = []
|
||||
punted = []
|
||||
|
||||
class User(object):
|
||||
pass
|
||||
|
@ -97,10 +98,15 @@ def render_template(path, week=None, **kwargs):
|
|||
|
||||
userlist.append(u)
|
||||
|
||||
# create a subset of punted users
|
||||
if u.end:
|
||||
punted.append(u)
|
||||
|
||||
def user_key(u):
|
||||
return (u.start, u.username)
|
||||
|
||||
userlist.sort(key=user_key)
|
||||
punted.sort(key=user_key)
|
||||
|
||||
for u in userlist:
|
||||
user_start = parse(u.start, default=START)
|
||||
|
@ -123,7 +129,7 @@ def render_template(path, week=None, **kwargs):
|
|||
good=good, lame=lame, skip=skip, userlist=userlist,
|
||||
pool=(get_balance('Pool')-get_balance('Event')), paid=get_balance('Pool:Paid'),
|
||||
event=get_balance('Pool:Event'),
|
||||
debts=debts, **kwargs)
|
||||
debts=debts, punted=punted, **kwargs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
|
|
|
@ -31,3 +31,8 @@ Individual debts:
|
|||
% for (u, v) in sorted(debts, key=lambda p:p[1], reverse=True):
|
||||
${u"%20s %d \u20AC" % (u, v)}
|
||||
% endfor
|
||||
|
||||
PREVIOUSLY PUNTED (pay € 30 balance to return):
|
||||
% for (u) in sorted(punted, key=lambda p:p.username):
|
||||
${"%20s (%s)" % (u.username, u.end)}
|
||||
% endfor
|
||||
|
|
|
@ -21,3 +21,5 @@ Individual debts:
|
|||
% for (u, v) in sorted(debts, key=lambda p:p[1], reverse=True):
|
||||
${u"%20s %d \u20AC" % (u, v)}
|
||||
% endfor
|
||||
|
||||
People who are punted: ${", ".join(sorted([u.username for u in punted]))}
|
|
@ -63,3 +63,10 @@ Results for week beginning ${week_start.strftime("%F")}
|
|||
</tr>
|
||||
%endif
|
||||
</table>
|
||||
|
||||
<h2>Previously Punted (pay €30 to return):</h2>
|
||||
<ul>
|
||||
% for (u) in sorted(punted, key=lambda p:p.username):
|
||||
<li>${u.username} (${u.end})</li>
|
||||
% endfor
|
||||
</ul>
|
Loading…
Reference in a new issue