gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Mon Jan 23 02:02:28 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/d1b84fae (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c16bde1a (commit)
	from  https://github.com/Gnucash/gnucash/commit/ae6efa39 (commit)



commit d1b84fae9f73775ed57aefa2639b9c1408e24417
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jan 23 14:12:21 2023 +0800

    [balsheet-pnl] shorten workload by deduping commodities

diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index e1f5d2b44..ac0bc826a 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -764,12 +764,17 @@ also show overall period profit & loss."))
 
          ;; generate an exchange-fn for date, and cache its result.
          (get-date-exchange-fn
-          (let ((h (make-hash-table)))
+          (let ((h (make-hash-table))
+                (commodities (sort-and-delete-duplicates
+                              (map xaccAccountGetCommodity accounts)
+                              (lambda (a b)
+                                (gnc:string-locale<? (gnc-commodity-get-unique-name a)
+                                                     (gnc-commodity-get-unique-name b)))
+                              gnc-commodity-equal)))
             (lambda (date)
               (or (hashv-ref h date)
                   (let ((exchangefn (gnc:case-exchange-time-fn
-                                     price-source common-currency
-                                     (map xaccAccountGetCommodity accounts)
+                                     price-source common-currency commodities
                                      date #f #f)))
                     (hashv-set! h date exchangefn)
                     exchangefn)))))

commit c16bde1aeac7d5a6febf76ef236829cc11ead358
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jan 23 13:27:57 2023 +0800

    [commodity-utilities] shorten workload by deduping commodities

diff --git a/gnucash/report/commodity-utilities.scm b/gnucash/report/commodity-utilities.scm
index 5e1990de2..2ca72f09c 100644
--- a/gnucash/report/commodity-utilities.scm
+++ b/gnucash/report/commodity-utilities.scm
@@ -229,6 +229,12 @@
           (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))
          (all-splits (get-all-splits currency-accounts end-date))
          (interesting-splits (sort (filter interesting-split? all-splits) date<?))
+         (commodity-list (sort-and-delete-duplicates
+                          commodity-list
+                          (lambda (a b)
+                            (gnc:string-locale<? (gnc-commodity-get-unique-name a)
+                                                 (gnc-commodity-get-unique-name b)))
+                          gnc-commodity-equal))
          (work-to-do (length commodity-list)))
     (map
      (lambda (c work-done)



Summary of changes:
 gnucash/report/commodity-utilities.scm           |  6 ++++++
 gnucash/report/reports/standard/balsheet-pnl.scm | 11 ++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list