hledger/hledger-lib/Hledger
Simon Michael e0fab4f882
Merge pull request #1256 from Xitian9/balanceReport
SMorgan: 
This PR aims to accomplish two major goals:

-    Get boring parent ellision working for multiBalanceReport
-    Remove the special BalanceReport code, and just use multiBalanceReport

I believe it does both, with the following additional benefits:

    A refactor of multiBalanceReportWith, to make the structure easier to follow, and with a clearer division of responsibilities
    All decisions for how an account name is to be displayed are now made in multiBalanceReport, rather than scattered around the code base
    Some miscellaneous improvements in account name rendering, including --drop now working with MultiBalanceReports, and addressing some of #373

Algorithmic changes:

-    Using HashMap AccountName (Map DateSpan Account) instead of [[MixedAmount]] is new. I admit I didn't profile this change (though given the nubs and lookups, I thought it was appropriate), so I'm glad it produces a speedup.
-    Producing the starting balances no longer calls the whole balanceReport, just the first few functions to get what it needs.
-    displayedAccounts is completely rewritten. Perhaps one subtle thing to note is that in tree mode it no longer excludes nodes with zero inclusive balance unless they also have zero exclusive balance.

SMichael: 
I'll mark the passing of the old multiBalanceReport, into which I poured many an hour :). It is in a way the heart (brain ?) of hledger - the key feature of ledgerlikes (balance report) and a key improvement introduced by hledger (tabular multiperiod balance reports). You have split that 300-line though well documented function into modular parts, which could be a little harder to understand in detail but are easier to understand in the large and more amenable to further refactoring. Then you fixed some old limitations (boring parent eliding in multi period balance reports, --drop with tree mode reports), allowing us to drop the old balanceReport and focus on just the new multiBalanceReport. And for representing the tabular data you replaced the semantically correct but inefficient list of lists with a map of maps, speeding up many-columned balance reports significantly (~40%). Last and not least you made it really easy to review. Thanks @Xitian9, great work.
2020-06-23 06:42:22 -07:00
..
Data lib: Elide account if more components are dropped than exist. 2020-06-22 13:41:22 -07:00
Read lib: only memoize in csv reader when there are more than 15 cond. blocks 2020-06-22 12:10:47 -07:00
Reports lib: multiBalanceReport: Accounts with no subaccounts are never interesting parents, even if no_elide_ is set. 2020-06-23 13:19:52 +10:00
Utils ;lib: Debug comment 2020-06-19 14:39:32 -07:00
Data.hs move JSON instances from hledger-web to hledger-lib 2019-12-16 17:17:00 -08:00
Query.hs lib: clarify zero-checking function names 2020-05-29 18:57:22 -07:00
Read.hs tweak debug levels, document some guidelines 2020-06-14 17:17:09 -07:00
Reports.hs ;lib: rename MultiBalanceReports.hs -> MultiBalanceReport.hs 2019-06-14 11:45:25 -07:00
Utils.hs lib: Replace some utility functions with library functions. 2020-03-02 12:45:30 -08:00