Skip to content

Commit

Permalink
Optimised as_of entries filter calculation (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer-639 authored Apr 2, 2024
1 parent 4eb4c94 commit 0c14ba6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pyluca/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ def __init__(self, journal: Journal, config: dict):

def journal_entries_as_of(self, as_of: Optional[datetime]):
if as_of is not None:
return [entry for entry in self.journal.entries if entry.date <= as_of]
entries = []
for entry in self.journal.entries:
if entry.date <= as_of:
entries.append(entry)
else:
break
return entries
return self.journal.entries

def get_account_dr(self, account: str, as_of: Optional[datetime] = None):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name='pyluca',
version='2.6.0',
version='2.6.1',
author='datasignstech',
author_email='[email protected]',
description='Double entry accounting system',
Expand Down

0 comments on commit 0c14ba6

Please sign in to comment.