From 60558f6ad185a66c1da67f0fd0123c4b26d3381f Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Wed, 6 Feb 2019 21:41:20 +0800 Subject: [PATCH] [report-utilities] (gnc:account-get-balances-at-dates) documentation the algorithm assumes dates-list is sorted chronologically. enforce it, and document. --- gnucash/report/report-system/report-utilities.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm index 02ceb4140f..e1b650e3a6 100644 --- a/gnucash/report/report-system/report-utilities.scm +++ b/gnucash/report/report-system/report-utilities.scm @@ -431,7 +431,7 @@ flawed. see report-utilities.scm. please update reports.") ;; this function will scan through the account splitlist, building ;; a list of balances along the way at dates specified in dates-list. ;; in: account -;; dates-list (list of time64) +;; dates-list (list of time64) - NOTE: IT WILL BE SORTED ;; split->amount - an unary lambda. calling (split->amount split) ;; returns a number, or #f which effectively skips the split. ;; out: (list bal0 bal1 ...), each entry is a gnc-monetary object @@ -445,7 +445,7 @@ flawed. see report-utilities.scm. please update reports.") (define (amount->monetary bal) (gnc:make-gnc-monetary (xaccAccountGetCommodity account) bal)) (let loop ((splits (xaccAccountGetSplitList account)) - (dates-list dates-list) + (dates-list (stable-sort! dates-list <)) (currentbal 0) (lastbal 0) (balancelist '()))