mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
various reports: use more efficient report-utilities.scm functions
instead of delete-duplicates
This commit is contained in:
parent
ae4b7e1582
commit
aa95d61c6c
@ -292,9 +292,7 @@
|
||||
(expense-accounts (opt-val pagename-expenseaccounts optname-expenseaccounts))
|
||||
(sales-accounts (opt-val pagename-incomeaccounts optname-incomeaccounts))
|
||||
(all-accounts (append sales-accounts expense-accounts))
|
||||
(commodities (delete-duplicates
|
||||
(map xaccAccountGetCommodity all-accounts)
|
||||
gnc-commodity-equiv))
|
||||
(commodities (gnc:accounts-get-commodities all-accounts #f))
|
||||
(commodities>1? (> (length commodities) 1))
|
||||
(book (gnc-get-current-book))
|
||||
(date-format (gnc:options-fancy-date book))
|
||||
|
@ -167,8 +167,7 @@ date point, a projected minimum balance including scheduled transactions."))
|
||||
(accum (gnc:make-commodity-collector))
|
||||
(exchange-fn (gnc:case-exchange-time-fn
|
||||
price currency
|
||||
(delete-duplicates! (map xaccAccountGetCommodity accounts)
|
||||
gnc-commodity-equiv)
|
||||
(gnc:accounts-get-commodities accounts #f)
|
||||
to-date #f #f))
|
||||
(accounts-balancelist
|
||||
(map
|
||||
|
@ -802,12 +802,7 @@ also show overall period profit & loss."))
|
||||
;; missing price, say so.
|
||||
(get-exchange-rates-fn
|
||||
(lambda (accounts col-idx)
|
||||
(let ((commodities (delete
|
||||
common-currency
|
||||
(delete-duplicates
|
||||
(map xaccAccountGetCommodity accounts)
|
||||
gnc-commodity-equal)
|
||||
gnc-commodity-equal))
|
||||
(let ((commodities (gnc:accounts-get-commodities accounts common-currency))
|
||||
(cell (gnc:make-html-text)))
|
||||
(for-each
|
||||
(lambda (commodity)
|
||||
|
@ -375,8 +375,7 @@ developing over time"))
|
||||
(xaccSplitGetAmount s))))))))
|
||||
;; all selected accounts (of report-specific type), *and*
|
||||
;; their descendants (of any type) need to be scanned.
|
||||
(delete-duplicates
|
||||
(append accounts (gnc:acccounts-get-all-subaccounts accounts)))))
|
||||
(gnc:accounts-and-all-descendants accounts)))
|
||||
|
||||
;; Creates the <balance-list> to be used in the function
|
||||
;; below.
|
||||
|
@ -226,21 +226,9 @@
|
||||
;; add accounts to the query (include subaccounts
|
||||
;; if requested)
|
||||
(gnc:report-percent-done 25)
|
||||
(if dosubs?
|
||||
(let ((subaccts '()))
|
||||
(for-each
|
||||
(lambda (acct)
|
||||
(let ((this-acct-subs
|
||||
(gnc-account-get-descendants-sorted acct)))
|
||||
(if (list? this-acct-subs)
|
||||
(set! subaccts
|
||||
(append subaccts this-acct-subs)))))
|
||||
accounts)
|
||||
;; Beware: delete-duplicates is an O(n^2)
|
||||
;; algorithm. More efficient method: sort the list,
|
||||
;; then use a linear algorithm.
|
||||
(set! accounts
|
||||
(delete-duplicates (append accounts subaccts)))))
|
||||
(if dosubs?
|
||||
(set! accounts
|
||||
(gnc:accounts-and-all-descendants accounts)))
|
||||
(gnc:report-percent-done 30)
|
||||
|
||||
(xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
|
||||
|
Loading…
Reference in New Issue
Block a user