Prepare for floating-point values in ledger
This commit is contained in:
parent
4d44325493
commit
e66cf1bdbe
|
@ -71,7 +71,7 @@ def render_template(path, week=None):
|
|||
'-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:'],
|
||||
|
@ -82,7 +82,7 @@ def render_template(path, week=None):
|
|||
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(
|
||||
|
|
|
@ -20,8 +20,8 @@ People who have not yet started:
|
|||
|
||||
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):
|
||||
|
|
|
@ -31,9 +31,9 @@ Results for week beginning ${week_start.strftime("%F")}
|
|||
|
||||
<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>
|
||||
|
|
Loading…
Reference in a new issue