[commodity-utilities.scm] gnc:get-commoditylist-totalavg-prices uses premade function

gnc:get-match-commodity-splits-sorted does the exact same job.
pull/1850/head
Christopher Lam 2 years ago
parent 1a5247c10e
commit 706030f7b0

@ -218,17 +218,9 @@
(define (gnc:get-commoditylist-totalavg-prices
commodity-list report-currency end-date
start-percent delta-percent)
(define (interesting-split? s)
(not (gnc-commodity-equiv
(xaccTransGetCurrency (xaccSplitGetParent s))
(xaccAccountGetCommodity (xaccSplitGetAccount s)))))
(define (date<? a b)
(< (xaccTransGetDate (xaccSplitGetParent a))
(xaccTransGetDate (xaccSplitGetParent b))))
(let* ((currency-accounts
(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<?))
(interesting-splits (gnc:get-match-commodity-splits-sorted currency-accounts end-date #f))
(commodity-list (delete-duplicates commodity-list))
(work-to-do (length commodity-list)))
(map

Loading…
Cancel
Save