CURRENCY = "$"
# check the version of ledger to find out which commands to use
-if subprocess.check_output(['ledger', '--version'])[7] == 3:
+if subprocess.check_output(['ledger', '--version'])[7] == "3":
BALANCE_CMD = ['ledger', '-f', os.path.join(HERE,'ledger'),
'--no-color', '-n', 'balance']
from config import *
def get_balance(acct):
- print acct
balance_cmd_tmp = BALANCE_CMD
balance_cmd_tmp.append(acct)
p = subprocess.Popen(balance_cmd_tmp,
if not line: continue
(val, acct) = line.split()
user = acct[len("Pool:Owed:"):]
+ if not user: continue
val = float(re.sub(r'(\D)?(\d+)$', r'\2', val))
debts.append((user, val))
return debts
for u in userlist:
user_start = datetime.datetime(*(u.start.timetuple()[:6]))
- if u.end and parse(u.end, default=START) <= week_start:
+ if u.end and datetime.datetime(*(u.end.timetuple()[:6])) <= week_start:
continue
if should_skip(u.skip, week):
% for u in sorted(lame, key=lambda u:u.username):
-${week_end.strftime("%F")} Week ${week}
+${week_end.strftime("%F")} Fine Week ${week}
User:${u.username} -${fine}
Pool:Owed:${u.username}
% endfor
with open('ledger', 'a') as f:
f.write("\n")
for (user, debt) in debts:
- if debt < (FINE_SIZE * 6): continue
+ if debt <= (FINE_SIZE * 6): continue
punt.append(user)
f.write("""\
%(date)s Punt