From c045e7c5ecb10ab051332693ab6bb9ef5901a452 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Wed, 9 Jan 2019 08:55:47 +0800 Subject: [PATCH] [commodity-utilities] simplify gnc:uniform-commodity? old code was confusing; returns non-#f if either of following is true: - elts is null list - elts is 1-element list and report-commodity is a member of this 1-element list change to much more intelligible code --- gnucash/report/report-system/commodity-utilities.scm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gnucash/report/report-system/commodity-utilities.scm b/gnucash/report/report-system/commodity-utilities.scm index 5737bfdad1..1e938ebd98 100644 --- a/gnucash/report/report-system/commodity-utilities.scm +++ b/gnucash/report/report-system/commodity-utilities.scm @@ -1032,9 +1032,7 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.") (define (gnc:uniform-commodity? amt report-commodity) ;; function to see if the commodity-collector amt ;; contains any foreign commodities - (let ((elts (amt 'format (lambda (comm amt) comm) #f))) - (or (null? elts) - (and (null? (cdr elts)) - (member report-commodity - elts - gnc-commodity-equiv))))) + (let ((list-of-commodities (amt 'format (lambda (comm amt) comm) #f))) + (or (null? list-of-commodities) + (and (null? (cdr list-of-commodities)) + (gnc-commodity-equiv report-commodity (car list-of-commodities))))))