mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[balsheet-pnl] shorten workload by deduping commodities
This commit is contained in:
parent
c16bde1aea
commit
d1b84fae9f
@ -764,12 +764,17 @@ also show overall period profit & loss."))
|
|||||||
|
|
||||||
;; generate an exchange-fn for date, and cache its result.
|
;; generate an exchange-fn for date, and cache its result.
|
||||||
(get-date-exchange-fn
|
(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)
|
(lambda (date)
|
||||||
(or (hashv-ref h date)
|
(or (hashv-ref h date)
|
||||||
(let ((exchangefn (gnc:case-exchange-time-fn
|
(let ((exchangefn (gnc:case-exchange-time-fn
|
||||||
price-source common-currency
|
price-source common-currency commodities
|
||||||
(map xaccAccountGetCommodity accounts)
|
|
||||||
date #f #f)))
|
date #f #f)))
|
||||||
(hashv-set! h date exchangefn)
|
(hashv-set! h date exchangefn)
|
||||||
exchangefn)))))
|
exchangefn)))))
|
||||||
|
Loading…
Reference in New Issue
Block a user