mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-utilities] use fold for gnc:accounts-count-splits
previous definition would build intermediate lists for each step. also handles the null account-list.
This commit is contained in:
parent
3a6d1ea663
commit
34be3c8b14
@ -741,7 +741,7 @@ query instead.")
|
||||
|
||||
;; function to count the total number of splits to be iterated
|
||||
(define (gnc:accounts-count-splits accounts)
|
||||
(apply + (map length (map xaccAccountGetSplitList accounts))))
|
||||
(fold (lambda (a b) (+ b (length (xaccAccountGetSplitList a)))) 0 accounts))
|
||||
|
||||
;; Sums up any splits of a certain type affecting a set of accounts.
|
||||
;; the type is an alist '((str "match me") (cased #f) (regexp #f))
|
||||
|
@ -477,6 +477,10 @@
|
||||
44
|
||||
(gnc:accounts-count-splits (list expense income)))
|
||||
|
||||
(test-equal "gnc:accounts-count-splits null"
|
||||
0
|
||||
(gnc:accounts-count-splits '()))
|
||||
|
||||
(let ((account-balances (gnc:get-assoc-account-balances
|
||||
(list bank gbp-bank)
|
||||
(lambda (acct)
|
||||
|
Loading…
Reference in New Issue
Block a user