Transaksjonslisten i ShowUserMenu begrenset til siste 20.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2010-05-08 21:35:30 +00:00
parent 90283a81b5
commit 0b36fa75d1
1 changed files with 6 additions and 2 deletions

View File

@ -299,11 +299,15 @@ class ShowUserMenu(Menu):
self.pause()
def print_transactions(self, user):
limit = 20
if len(user.transactions) == 0:
print 'No transactions'
return
print 'Transactions:'
for t in user.transactions:
if len(user.transactions) <= limit:
print 'Transactions:'
else:
print 'Transactions (last %d):' % limit
for t in user.transactions[-limit:]:
string = ' * %s: %s %d kr, ' % \
(t.time.strftime('%Y-%m-%d %H:%M'),
{True:'in', False:'out'}[t.amount<0],