diff --git a/drcr/webapp.py b/drcr/webapp.py index 312ca9c..dae6e90 100644 --- a/drcr/webapp.py +++ b/drcr/webapp.py @@ -75,8 +75,9 @@ def api_transactions(start_date=None, end_date=None): return transactions def all_accounts(): - # TODO: Can this be cached? - return sorted(list(set(p.account for t in all_transactions() for p in t.postings))) + """Return all accounts in alphabetical order""" + + return db.session.scalars('SELECT DISTINCT account FROM postings ORDER BY account').all() def eofy_date(): """Get the datetime for the end of the financial year"""