Bug 797573 - Incorrect value of securities in the Asset Chart

Algorithms used xaccFooOrder to attempt strict ordering of Foo
objects. Unfortunately the internal definitions of xaccAccountOrder
does not guarantee a strict ordering of accounts.

Also remove unused split<? comparator.
This commit is contained in:
Christopher Lam 2020-01-13 22:03:10 +08:00
parent d61453d3cf
commit 5ac7f1beaf
4 changed files with 6 additions and 14 deletions

View File

@ -177,9 +177,6 @@ exist but have no suitable transactions."))
(define (gnc-owner-equal? a b)
(string=? (gncOwnerReturnGUID a) (gncOwnerReturnGUID b)))
(define (account<? a b)
(< (xaccAccountOrder a b) 0))
(define (split-has-owner? split owner)
(let* ((split-owner (split->owner split))
(retval (gnc-owner-equal? split-owner owner)))
@ -266,9 +263,7 @@ exist but have no suitable transactions."))
(else
(setup-query query accounts report-date)
(let* ((splits (xaccQueryGetSplitsUniqueTrans query))
(accounts (sort-and-delete-duplicates (map xaccSplitGetAccount splits)
account<? equal?)))
(let* ((splits (xaccQueryGetSplitsUniqueTrans query)))
(qof-query-destroy query)
;; loop into each APAR account

View File

@ -240,8 +240,6 @@
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-PAYMENT))
(define (txn-is-link? txn)
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-LINK))
(define (split<? a b)
(< (xaccSplitOrder a b) 0))
(define (split-is-payment? split)
(txn-is-payment? (xaccSplitGetParent split)))

View File

@ -155,8 +155,7 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
(define (gnc:accounts-and-all-descendants accountslist)
(sort-and-delete-duplicates
(apply append accountslist (map gnc-account-get-descendants accountslist))
(lambda (a b) (< (xaccAccountOrder a b) 0))
equal?))
gnc:account-path-less-p equal?))
;;; Here's a statistics collector... Collects max, min, total, and makes
;;; it easy to get at the mean.

View File

@ -273,10 +273,10 @@
(set-option! balance-sheet-options "Display" "Parent account subtotals" 'f)
(let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-recursive")))
(test-equal "recursive. root = $760+15000+104600"
'("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
'("#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
(sxml->table-row-col sxml 1 3 6))
(test-equal "recursive. assets = $760+15000+104600"
'("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
'("#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
(sxml->table-row-col sxml 1 4 5))
(test-equal "recursive. bank1 = $4,709.00"
(list "$4,709.00")
@ -294,7 +294,7 @@
(list "$100.00")
(sxml->table-row-col sxml 1 9 3))
(test-equal "recursive. broker = $15000+2000.00"
'("$2,000.00" "$2,000.00" "30 FUNDS" "$15,000.00")
'("30 FUNDS" "$15,000.00" "$2,000.00" "$2,000.00")
(sxml->table-row-col sxml 1 10 4))
(test-equal "recursive. funds = $15,000.00"
(list "30 FUNDS" "$15,000.00" "$15,000.00")
@ -326,7 +326,7 @@
(set-option! balance-sheet-options "Commodities" "Show Exchange Rates" #t)
(let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-enable show-fcur show-rates")))
(test-equal "show-fcur enabled"
'("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
'("#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
(sxml->table-row-col sxml 1 3 6))
(test-equal "show-rates enabled"
'("#1.00" "$1.70" "1 FUNDS" "$500.00")