mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[reports] change xaccAccountGetSplitList to xaccAccountGetSplits
because the latter is more efficient. fewer doubly-link list traversals.
This commit is contained in:
parent
6d7f4ec4c8
commit
35ecad8d21
@ -66,7 +66,7 @@
|
|||||||
;; This procedure does all the work. We'll define it, then call it safely.
|
;; This procedure does all the work. We'll define it, then call it safely.
|
||||||
(define (private-find)
|
(define (private-find)
|
||||||
(cond
|
(cond
|
||||||
((any (compose pair? xaccAccountGetSplitList) old-accounts)
|
((any (compose positive? xaccAccountGetSplitsSize) old-accounts)
|
||||||
;; Get all the splits in the new tree, then iterate over them
|
;; Get all the splits in the new tree, then iterate over them
|
||||||
;; trying to find matches in the old tree. If there are
|
;; trying to find matches in the old tree. If there are
|
||||||
;; matches, push the splits' parent onto a list.
|
;; matches, push the splits' parent onto a list.
|
||||||
|
@ -476,8 +476,8 @@
|
|||||||
(define (less? a b) (< (to-date a) (to-date b)))
|
(define (less? a b) (< (to-date a) (to-date b)))
|
||||||
|
|
||||||
(let lp ((splits (if split->date
|
(let lp ((splits (if split->date
|
||||||
(stable-sort! (xaccAccountGetSplitList acc) less?)
|
(sort (xaccAccountGetSplits acc) less?)
|
||||||
(xaccAccountGetSplitList acc)))
|
(xaccAccountGetSplits acc)))
|
||||||
(dates (sort dates <))
|
(dates (sort dates <))
|
||||||
(result '())
|
(result '())
|
||||||
(last-result nosplit->elt))
|
(last-result nosplit->elt))
|
||||||
@ -1242,7 +1242,7 @@
|
|||||||
(gnc-account-get-full-name acc)
|
(gnc-account-get-full-name acc)
|
||||||
(gnc-commodity-get-mnemonic (xaccAccountGetCommodity acc))
|
(gnc-commodity-get-mnemonic (xaccAccountGetCommodity acc))
|
||||||
(xaccAccountGetTypeStr (xaccAccountGetType acc)))
|
(xaccAccountGetTypeStr (xaccAccountGetType acc)))
|
||||||
(for-each (cut gnc:dump-split <> #f) (xaccAccountGetSplitList acc))
|
(for-each (cut gnc:dump-split <> #f) (xaccAccountGetSplits acc))
|
||||||
(format #t " Balance: ~a Cleared: ~a Reconciled: ~a\n"
|
(format #t " Balance: ~a Cleared: ~a Reconciled: ~a\n"
|
||||||
(gnc:monetary->string
|
(gnc:monetary->string
|
||||||
(gnc:make-gnc-monetary
|
(gnc:make-gnc-monetary
|
||||||
@ -1267,7 +1267,7 @@
|
|||||||
(gnc-get-current-root-account))))
|
(gnc-get-current-root-account))))
|
||||||
(inv-txns (filter (lambda (t) (eqv? (xaccTransGetTxnType t) TXN-TYPE-INVOICE))
|
(inv-txns (filter (lambda (t) (eqv? (xaccTransGetTxnType t) TXN-TYPE-INVOICE))
|
||||||
(map xaccSplitGetParent
|
(map xaccSplitGetParent
|
||||||
(append-map xaccAccountGetSplitList acc-APAR))))
|
(append-map xaccAccountGetSplits acc-APAR))))
|
||||||
(invoices (map gncInvoiceGetInvoiceFromTxn inv-txns)))
|
(invoices (map gncInvoiceGetInvoiceFromTxn inv-txns)))
|
||||||
(define (maybe-date time64) ;handle INT-MAX differently
|
(define (maybe-date time64) ;handle INT-MAX differently
|
||||||
(if (= 9223372036854775807 time64) "?" (qof-print-date time64)))
|
(if (= 9223372036854775807 time64) "?" (qof-print-date time64)))
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
|
|
||||||
(define (make-split-list account split-filter-pred)
|
(define (make-split-list account split-filter-pred)
|
||||||
(reverse (filter split-filter-pred
|
(reverse (filter split-filter-pred
|
||||||
(xaccAccountGetSplitList account))))
|
(xaccAccountGetSplits account))))
|
||||||
|
|
||||||
;; returns a predicate that returns true only if a split is
|
;; returns a predicate that returns true only if a split is
|
||||||
;; between early-date and late-date
|
;; between early-date and late-date
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
(define after-tax-day (< tax-day today))
|
(define after-tax-day (< tax-day today))
|
||||||
|
|
||||||
(define (make-split-list account split-filter-pred)
|
(define (make-split-list account split-filter-pred)
|
||||||
(filter split-filter-pred (xaccAccountGetSplitList account)))
|
(filter split-filter-pred (xaccAccountGetSplits account)))
|
||||||
|
|
||||||
;; returns a predicate that returns true only if a split is
|
;; returns a predicate that returns true only if a split is
|
||||||
;; between early-date and late-date
|
;; between early-date and late-date
|
||||||
|
@ -772,7 +772,7 @@ by preventing negative stock balances.<br/>")
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(xaccAccountGetSplitList current)
|
(xaccAccountGetSplits current)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Look for income and expense transactions that don't have a split in the
|
;; Look for income and expense transactions that don't have a split in the
|
||||||
@ -832,7 +832,7 @@ by preventing negative stock balances.<br/>")
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(xaccAccountGetSplitList parent-account)
|
(xaccAccountGetSplits parent-account)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -193,7 +193,7 @@ date point, a projected minimum balance including scheduled transactions."))
|
|||||||
;; accounts up to the report start date.
|
;; accounts up to the report start date.
|
||||||
(let* ((accounts-dates (map (compose xaccTransGetDate xaccSplitGetParent car)
|
(let* ((accounts-dates (map (compose xaccTransGetDate xaccSplitGetParent car)
|
||||||
(filter pair?
|
(filter pair?
|
||||||
(map xaccAccountGetSplitList accounts))))
|
(map xaccAccountGetSplits accounts))))
|
||||||
(earliest (and (pair? accounts-dates) (apply min accounts-dates)))
|
(earliest (and (pair? accounts-dates) (apply min accounts-dates)))
|
||||||
(sx-hash (if earliest
|
(sx-hash (if earliest
|
||||||
(gnc-sx-all-instantiate-cashflow-all earliest from-date)
|
(gnc-sx-all-instantiate-cashflow-all earliest from-date)
|
||||||
|
@ -175,7 +175,7 @@
|
|||||||
(and (eq? direction 'out)
|
(and (eq? direction 'out)
|
||||||
(negative? split-value))))
|
(negative? split-value))))
|
||||||
(total-flow 'add (xaccTransGetCurrency transaction) split-value))))
|
(total-flow 'add (xaccTransGetCurrency transaction) split-value))))
|
||||||
(xaccAccountGetSplitList target-account)))
|
(xaccAccountGetSplits target-account)))
|
||||||
target-account-list)
|
target-account-list)
|
||||||
total-flow))
|
total-flow))
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@
|
|||||||
;; (xaccSplitGetAmount s)
|
;; (xaccSplitGetAmount s)
|
||||||
;; (xaccAccountGetName (xaccSplitGetAccount (xaccSplitGetOtherSplit s)))
|
;; (xaccAccountGetName (xaccSplitGetAccount (xaccSplitGetOtherSplit s)))
|
||||||
;; ))
|
;; ))
|
||||||
;; (xaccAccountGetSplitList bank))
|
;; (xaccAccountGetSplits bank))
|
||||||
|
|
||||||
;; Finally we can begin testing
|
;; Finally we can begin testing
|
||||||
(test-begin "general options")
|
(test-begin "general options")
|
||||||
|
Loading…
Reference in New Issue
Block a user