[average-balance] destroy the query after using it

also fix comments and whitespace
This commit is contained in:
Christopher Lam 2019-03-23 12:42:17 +08:00
parent 9b9d264a04
commit bc553ed00e
2 changed files with 5 additions and 9 deletions

View File

@ -260,6 +260,7 @@
(exchange-fn monetary target-curr date))))) (exchange-fn monetary target-curr date)))))
daily-dates daily-dates
accounts-balances-transposed))) accounts-balances-transposed)))
(qof-query-destroy query)
;; this is a complicated tight loop. start with: ;; this is a complicated tight loop. start with:
;; daily-balances & daily-dates, interval-dates, and the ;; daily-balances & daily-dates, interval-dates, and the
@ -307,9 +308,9 @@
(apply + (filter positive? interval-amts)) (apply + (filter positive? interval-amts))
(- (apply + (filter negative? interval-amts))) (- (apply + (filter negative? interval-amts)))
(apply + interval-amts)) (apply + interval-amts))
results) results) ;process interval amts&bals
'() '() ;reset interval-bals
'() '() ;and interval-amts
splits splits
daily-balances daily-balances
daily-dates daily-dates

View File

@ -46,17 +46,12 @@
(define (test-average-balance) (define (test-average-balance)
(let* ((env (create-test-env)) (let* ((env (create-test-env))
(account-alist (env-create-account-structure-alist env structure)) (account-alist (env-create-account-structure-alist env structure))
(options (gnc:make-report-options uuid)) (options (gnc:make-report-options uuid))
(bank (cdr (assoc "Bank" account-alist))) (bank (cdr (assoc "Bank" account-alist)))
(bank2 (cdr (assoc "Another Bank" account-alist))) (bank2 (cdr (assoc "Another Bank" account-alist)))
(income (cdr (assoc "Income" account-alist)))) (income (cdr (assoc "Income" account-alist))))
(define (default-testing-options) (define (default-testing-options)
;; To ease testing of transaction report, we will set default
;; options for generating reports. We will elable extra columns
;; for Exporting, disable generation of informational text, and
;; disable indenting. These options will be tested separately as
;; the first test group. By default, we'll select the modern dates.
(let ((options (gnc:make-report-options uuid))) (let ((options (gnc:make-report-options uuid)))
(set-option! options "Accounts" "Accounts" (list bank bank2)) (set-option! options "Accounts" "Accounts" (list bank bank2))
(set-option! options "Display" "Show table" #t) (set-option! options "Display" "Show table" #t)