'-n', 'balance', acct],
stdout=subprocess.PIPE)
(out, _) = p.communicate()
- return int(out.split()[0][1:])
+ return float(out.split()[0][1:])
p = subprocess.Popen(['ledger', '-f', os.path.join(HERE,'ledger'),
'-n', 'balance', 'Pool:Owed:'],
if not line: continue
(val, acct) = line.split()
user = acct[len("Pool:Owed:"):]
- val = int(val[len("$"):])
+ val = float(val[len("$"):])
debts.append((user, val))
return Template(filename=path, output_encoding='utf-8').render(
Beer pool:
This week: $${5 * len(lame)}.00
-Total: $${pool}.00
-Paid: $${paid}.00
+Total: $${pool}
+Paid: $${paid}
Individual debts:
% for (u, v) in sorted(debts, key=lambda p:p[1], reverse=True):
<h2>Beer pool:</h2>
<table>
- <tr> <td> This week: </td> <td> $${5 * len(lame)}.00 </td> </tr>
- <tr> <td> Total: </td> <td> $${pool}.00 </td> </tr>
- <tr> <td> Paid: </td> <td> $${paid}.00 </td> </tr>
+ <tr> <td> This week: </td> <td> $${5 * len(lame)} </td> </tr>
+ <tr> <td> Total: </td> <td> $${pool} </td> </tr>
+ <tr> <td> Paid: </td> <td> $${paid} </td> </tr>
</table>
<h2>Debts:</h2>