gnucash master: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Sat Jul 4 01:53:09 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/207616ab (commit)
via https://github.com/Gnucash/gnucash/commit/9a9fa5e5 (commit)
from https://github.com/Gnucash/gnucash/commit/95b552fa (commit)
commit 207616ab13887ceb5626e116e4cca231365c9375
Merge: 95b552fa5 9a9fa5e5d
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Jul 4 13:09:24 2020 +0800
Merge branch 'master-no-coll-rounding' #740
commit 9a9fa5e5de45d2dc001a406073a1b77cd4cae439
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Jun 20 11:40:09 2020 +0800
[report-utilities] ensure commodity-collector doesn't round amounts
diff --git a/gnucash/report/report-utilities.scm b/gnucash/report/report-utilities.scm
index f18b3a553..0859bd85f 100644
--- a/gnucash/report/report-utilities.scm
+++ b/gnucash/report/report-utilities.scm
@@ -230,14 +230,11 @@
;; helper function to add a (commodity . value) pair to our list.
;; If no pair with this commodity exists, we will create one.
(define (add-commodity-value commodity value)
- (let ((pair (assoc commodity commoditylist))
- (rvalue (gnc-numeric-convert
- value
- (gnc-commodity-get-fraction commodity) GNC-RND-ROUND)))
+ (let ((pair (assoc commodity commoditylist)))
(unless pair
(set! pair (list commodity (gnc:make-value-collector)))
(set! commoditylist (cons pair commoditylist)))
- ((cadr pair) 'add rvalue)))
+ ((cadr pair) 'add value)))
;; helper function to walk an association list, adding each
;; (commodity . collector) pair to our list at the appropriate
diff --git a/gnucash/report/test/test-report-utilities.scm b/gnucash/report/test/test-report-utilities.scm
index 563cdd492..7cb732581 100644
--- a/gnucash/report/test/test-report-utilities.scm
+++ b/gnucash/report/test/test-report-utilities.scm
@@ -249,7 +249,18 @@
(coll-A 'add USD -25)
(test-equal "gnc-commodity-collector-allzero? #t"
#t
- (gnc-commodity-collector-allzero? coll-A)))
+ (gnc-commodity-collector-allzero? coll-A))
+
+ ;; the following tests whether commodity-collector rounds
+ ;; inappropriately
+ (coll-A 'reset #f #f)
+ (coll-A 'add GBP 1/3)
+ (coll-A 'add GBP 1/3)
+ (coll-A 'add GBP 1/3)
+ (coll-A 'add GBP -1)
+ (test-equal "gnc-commodity-collector does not round inappropriately"
+ '(("GBP" . 0))
+ (collector->list coll-A)))
(teardown)))
(define (mnemonic->commodity sym)
Summary of changes:
gnucash/report/report-utilities.scm | 7 ++-----
gnucash/report/test/test-report-utilities.scm | 13 ++++++++++++-
2 files changed, 14 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list