-
Notifications
You must be signed in to change notification settings - Fork 0
/
summary.py
executable file
·27 lines (22 loc) · 974 Bytes
/
summary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# QUICK SUMMARY GENERATOR FOR TIFMASTER
#
# This prints a list of keyholders and how much ahead or behind of the
# median they are as of the current state of the TIF database.
from tif import Keyholder, load, active_keys, last_median, minutes, hours_minutes, MEDIAN
from datetime import date
def summary():
load()
active_keyholders = active_keys(date.today()) # was max
active_keyholders.sort(
lambda a,b: minutes(b.current_balance() - a.current_balance()))
last = last_median()
print "%10s%12s%14s (=%s)\n" % ("Keyholder","Position","vs. Median",
(hours_minutes(last)))
for key in active_keyholders:
if key.initials==MEDIAN: continue
print "%10s%12s%14s" % (key.initials,
hours_minutes(key.current_balance()),
hours_minutes(key.current_balance() - last))
if __name__=='__main__':
summary()