More efficient implementation for all_accounts
This commit is contained in:
parent
e25855450c
commit
541086d346
@ -75,8 +75,9 @@ def api_transactions(start_date=None, end_date=None):
|
|||||||
return transactions
|
return transactions
|
||||||
|
|
||||||
def all_accounts():
|
def all_accounts():
|
||||||
# TODO: Can this be cached?
|
"""Return all accounts in alphabetical order"""
|
||||||
return sorted(list(set(p.account for t in all_transactions() for p in t.postings)))
|
|
||||||
|
return db.session.scalars('SELECT DISTINCT account FROM postings ORDER BY account').all()
|
||||||
|
|
||||||
def eofy_date():
|
def eofy_date():
|
||||||
"""Get the datetime for the end of the financial year"""
|
"""Get the datetime for the end of the financial year"""
|
||||||
|
Loading…
Reference in New Issue
Block a user