From 0b36fa75d14077c6a9492d6a0f38f02edc5cb7ed Mon Sep 17 00:00:00 2001 From: oysteini Date: Sat, 8 May 2010 21:35:30 +0000 Subject: [PATCH] Transaksjonslisten i ShowUserMenu begrenset til siste 20. --- text_based.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/text_based.py b/text_based.py index 67e444f..1cfbc1f 100644 --- a/text_based.py +++ b/text_based.py @@ -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],