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() self.pause()
def print_transactions(self, user): def print_transactions(self, user):
limit = 20
if len(user.transactions) == 0: if len(user.transactions) == 0:
print 'No transactions' print 'No transactions'
return return
if len(user.transactions) <= limit:
print 'Transactions:' print 'Transactions:'
for t in user.transactions: else:
print 'Transactions (last %d):' % limit
for t in user.transactions[-limit:]:
string = ' * %s: %s %d kr, ' % \ string = ' * %s: %s %d kr, ' % \
(t.time.strftime('%Y-%m-%d %H:%M'), (t.time.strftime('%Y-%m-%d %H:%M'),
{True:'in', False:'out'}[t.amount<0], {True:'in', False:'out'}[t.amount<0],