adamcharnock / django-hordak

Double entry accounting in Django
http://django-hordak.readthedocs.io
MIT License
238 stars 55 forks source link

Adding `get_balance()` database function #126

Closed adamcharnock closed 3 months ago

adamcharnock commented 3 months ago
postgres.public> select get_balance(7)
[2024-06-28 20:25:18] 1 row retrieved starting from 1 in 430 ms (execution: 420 ms, fetching: 10 ms)

That 420ms for an account with 1 million legs.

This is on an M2 Macbook. Also, if I just calculate the balance for the one account (not including children) then it shaves about 30-40% off the execution time. This is a decent win, but I think we'll get bigger gains from adding running totals as per #76.

codecov-commenter commented 3 months ago

Codecov Report

Attention: Patch coverage is 98.18182% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.02%. Comparing base (81b90df) to head (d9f9071). Report is 38 commits behind head on master.

Files Patch % Lines
hordak/utilities/db_functions.py 95.65% 0 Missing and 1 partial :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #126 +/- ## ========================================== - Coverage 93.01% 92.02% -0.99% ========================================== Files 59 66 +7 Lines 3836 4238 +402 Branches 249 274 +25 ========================================== + Hits 3568 3900 +332 - Misses 224 284 +60 - Partials 44 54 +10 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.