[reports] use more efficient gnc:accounts-and-all-descendants

All uses of gnc:acccounts-get-all-subaccounts were immediately
followed by appending the result to the original accounts list. Use
gnc:accounts-and-all-descendants instead which is more efficient.
pull/578/head
Christopher Lam 7 years ago
parent d0d6a824f4
commit 2ac8cb2f79

@ -293,11 +293,9 @@
(internal-included (not (get-option gnc:pagename-accounts optname-internal)))
(accounts (get-option gnc:pagename-accounts (N_ "Accounts")))
(dosubs? (get-option gnc:pagename-accounts optname-subacct))
(accounts (append accounts
(if dosubs?
(filter (lambda (acc) (not (member acc accounts)))
(gnc:acccounts-get-all-subaccounts accounts))
'())))
(accounts (if dosubs?
(gnc:accounts-and-all-descendants accounts)
accounts))
(plot-type (get-option gnc:pagename-display (N_ "Plot Type")))
(show-plot? (get-option gnc:pagename-display (N_ "Show plot")))
(show-table? (get-option gnc:pagename-display (N_ "Show table")))

@ -638,11 +638,9 @@
(get-option gnc:pagename-general
optname-period-collapse-after)))
(doc (gnc:make-html-document))
(accounts (append accounts
(filter (lambda (acc) (not (member acc accounts)))
(if show-subaccts?
(gnc:acccounts-get-all-subaccounts accounts)
'())))))
(accounts (if show-subaccts?
(gnc:accounts-and-all-descendants accounts)
accounts)))
;; end of defines
(cond

@ -156,11 +156,9 @@
(table (gnc:make-html-table))
;;add subaccounts if requested
(accounts (append accounts
(filter (lambda (acc) (not (member acc accounts)))
(if show-subaccts?
(gnc:acccounts-get-all-subaccounts accounts)
'()))))
(accounts (if show-subaccts?
(gnc:accounts-and-all-descendants accounts)
accounts))
(accounts (sort accounts account-full-name<?)))
(define (add-accounts-flow accounts accounts-alist)

@ -471,9 +471,7 @@ developing over time"))
;; needed so as to amortize the cpu time properly.
(gnc:report-percent-done 1)
(set! commodity-list (gnc:accounts-get-commodities
(append
(gnc:acccounts-get-all-subaccounts accounts)
accounts)
(gnc:accounts-and-all-descendants accounts)
report-currency))
(set! exchange-fn (gnc:case-exchange-time-fn
price-source report-currency

@ -204,10 +204,8 @@
;; lookup should be distributed and done when actually
;; needed so as to amortize the cpu time properly.
(gnc:report-percent-done 1)
(set! commodity-list (gnc:accounts-get-commodities
(append
(gnc:acccounts-get-all-subaccounts accounts)
accounts)
(set! commodity-list (gnc:accounts-get-commodities
(gnc:accounts-and-all-descendants accounts)
report-currency))
(gnc:report-percent-done 5)
(set! exchange-fn (gnc:case-exchange-time-fn

@ -317,9 +317,7 @@
(gnc:report-percent-done 1)
(set! commodity-list (gnc:accounts-get-commodities
(append
(gnc:acccounts-get-all-subaccounts accounts)
accounts)
(gnc:accounts-and-all-descendants accounts)
report-currency))
(gnc:report-percent-done 10)
(set! exchange-fn (gnc:case-exchange-time-fn

@ -195,9 +195,8 @@
;(gnc:debug "accounts" accounts)
(if (not (null? accounts))
(let* ((commodity-list (gnc:accounts-get-commodities
(append
(gnc:acccounts-get-all-subaccounts
accounts) accounts) currency))
(gnc:accounts-and-all-descendants accounts)
report-currency))
(pricedb (gnc-pricedb-get-db (gnc-get-current-book)))
(exchange-fn (gnc:case-exchange-fn price-source currency to-date))
(price-fn

Loading…
Cancel
Save