gnucash stable: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Mon Apr 22 07:36:13 EDT 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/5dab612d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3dc0df7f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/daadfcf4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0bd0f777 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a993e972 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/68f60fef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/cb7196a3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/80f82e9d (commit)



commit 5dab612d1b03c58f45ebcf3ccdc770d8b8ecccd1
Merge: 80f82e9d47 3dc0df7f38
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Apr 22 19:34:19 2024 +0800

    Merge branch 'bug799258-cpp' into stable #1920

commit 3dc0df7f383d1b839b1d0534de24922bbd3836c7
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Apr 21 14:00:49 2024 +0800

    [commodity-utilities.scm] routines upgraded to accept a #:hide-warnings? argument
    
    ... whose default is #f, therefore warnings are shown.
    
    In gnc:case-exchange-time-fn the routines are called at the report
    end-date once. Therefore all relevant splits are analysed for
    warnings.
    
    Subsequent calls (at various report dates) will omit warnings.

commit daadfcf426510d2c30c04fb88f010aadda7d3b22
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Apr 20 19:38:31 2024 +0800

    [balsheet-pnl.scm] use enhanced gnc:case-exchange-time-fn
    
    Because gnc:case-exchange-time-fn now handles multiple report dates
    correctly.

commit 0bd0f777428c5eaf0d0c4e81ce0190edd4b70174
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Apr 18 21:30:38 2024 +0800

    Bug 799258 - Reports calculating net worth incorrectly after stock split
    
    For average-cost and weighted-average: when the exchange-fn is
    created, it would formerly consider the whole book foreign currency
    conversions to calculate the date-specific conversions. This bug fix
    will limit the book conversions to those earlier than the
    date-specific conversions.
    
    The book retrieval functions are expensive, therefore the analysis
    splitlists are cached in the date-hash hash-table, which is scoped
    within the exchange-fn lambda only, and is garbage collected when
    exchange-fn is out of scope.
    
    Also: amend relevant commodity-utilities.scm tests
    
    The old weighted-average and average-cost tests were written to
    document the (knowingly) incorrect exchanged amounts as originally
    calculated pre-2024.
    
    In 2024, the exchange-fn is fixed so that foreign currency
    conversions at a particular report date would consider only
    transactions up to the relevant report date.
    
    The first AAPL transaction in this test book is on 09/08/2013: a
    purchase of 600 AAPL at $36840 total @ $61.40 each.
    
    Therefore the first test, on 20/02/2012 the AAPL->USD exchange rate
    conversion should be zero, since there are no AAPL transactions
    yet.
    
    Subsequent AAPL test on 20/02/2014 shows the conversion of 1
    AAPL to be 307/5 which matches $61.40.
    
    etc.

commit a993e97204ebd342b4b102e90d801b66016c2667
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Apr 18 00:19:28 2024 +0800

    [commodity-utilities.scm] use gnc_get_match_commodity_splits

commit 68f60fef6803fe1d0153c8af40dd5db835450b84
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Apr 18 00:19:10 2024 +0800

    [engine.i] gnc_get_match_commodity_splits from scheme to c++
    
    The scheme version is very inefficient: (1) it uses QofQuery to
    retrieve all splits, and QofQuery is slow. (2) The whole splitlist
    typically is thousands splits long needs to be converted from C to
    guile via consing and reverse. (3) The scheme list is immediately
    filtered to select "interesting" splits only.
    
    This function performs all of the above using Account's efficient
    methods, selecting only interesting splits into a GList. This list is
    then converted to scheme via cons and reverse.

commit cb7196a393973b28062600fea70e84996de02edc
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Apr 22 10:13:23 2024 +0800

    [base-typemaps.i] add VECTOR_HELPER_INOUT for Split* and Account*
    
    efficiently convert std::vector<Obj> to/from guile list of objects



Summary of changes:
 bindings/engine.i                                |  32 +++++
 common/base-typemaps.i                           |  23 ++++
 gnucash/report/commodity-utilities.scm           | 152 ++++++++++++-----------
 gnucash/report/reports/standard/balsheet-pnl.scm |  18 +--
 gnucash/report/test/test-commodity-utils.scm     |   8 +-
 5 files changed, 142 insertions(+), 91 deletions(-)



More information about the gnucash-patches mailing list