gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Thu Jul 4 09:52:59 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/bc1bcc71 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/75ab45ac (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6f217165 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3a927ce2 (commit)
	from  https://github.com/Gnucash/gnucash/commit/f82058e0 (commit)



commit bc1bcc718e509344bbda485c7475b4645d48cb9c
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Jul 3 19:35:58 2019 +0800

    [average-balance] show progress reports before chart generation
    
    This change adds progress reports to be more responsive on large
    datafiles. It is probably marginally slower.

diff --git a/gnucash/report/standard-reports/average-balance.scm b/gnucash/report/standard-reports/average-balance.scm
index 235aaf47c..e07383491 100644
--- a/gnucash/report/standard-reports/average-balance.scm
+++ b/gnucash/report/standard-reports/average-balance.scm
@@ -242,21 +242,35 @@
           (let* ((splits (qof-query-run query))
                  (daily-dates (gnc:make-date-list begindate enddate DayDelta))
                  (interval-dates (gnc:make-date-list begindate enddate stepsize))
+
+                 ;; for accounts-balances generation
+                 (work-to-do (length accounts))
                  (accounts-balances (map
-                                     (lambda (acc)
+                                     (lambda (work-done acc)
+                                       (gnc:report-percent-done
+                                        (* 100 (/ work-done work-to-do)))
                                        (gnc:account-get-balances-at-dates
                                         acc daily-dates))
+                                     (iota work-to-do)
                                      accounts))
+
+                 ;; for daily-balances generation
+                 (work-to-do (length daily-dates))
                  (balances (map
-                            (lambda (date accounts-balance)
+                            (lambda (work-done date accounts-balance)
+                              (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
                               (gnc:gnc-monetary-amount
                                (gnc:sum-collector-commodity
                                 (apply gnc:monetaries-add accounts-balance)
                                 report-currency
                                 (lambda (monetary target-curr)
                                   (exchange-fn monetary target-curr date)))))
+                            (iota work-to-do)
                             daily-dates
-                            (apply zip accounts-balances))))
+                            (apply zip accounts-balances)))
+
+                 ;; for upcoming interval-calculators
+                 (work-to-do (length splits)))
             (qof-query-destroy query)
 
             ;; this is a complicated tight loop. start with:
@@ -268,10 +282,12 @@
                        (interval-bals '())
                        (interval-amts '())
                        (splits splits)
+                       (work-done 0)
                        (daily-balances (cdr balances))
                        (daily-dates (cdr daily-dates))
                        (interval-start (car interval-dates))
                        (interval-dates (cdr interval-dates)))
+
               (cond
 
                ;; daily-dates finished. job done. add details for
@@ -294,6 +310,7 @@
                ;; first daily-date > first interval-date -- crossed
                ;; interval boundary -- add interval details to results
                ((> (car daily-dates) (car interval-dates))
+                (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
                 (loop (cons (list
                              (qof-print-date interval-start)
                              (qof-print-date (decdate (car interval-dates)
@@ -309,6 +326,7 @@
                       '()               ;reset interval-bals
                       '()               ;and interval-amts
                       splits
+                      work-done
                       daily-balances
                       daily-dates
                       (car interval-dates)
@@ -324,6 +342,7 @@
                       (cons (car daily-balances) interval-bals)
                       interval-amts
                       splits
+                      work-done
                       (cdr daily-balances)
                       (cdr daily-dates)
                       interval-start
@@ -344,6 +363,7 @@
                       interval-bals
                       interval-amts ;interval-amts unchanged
                       (cddr splits) ;skip two splits.
+                      (+ work-done 2)
                       daily-balances
                       daily-dates
                       interval-start
@@ -364,6 +384,7 @@
                               (car interval-dates)))
                             interval-amts) ;add split amt to list
                       (cdr splits)         ;and loop to next split
+                      (1+ work-done)
                       daily-balances
                       daily-dates
                       interval-start

commit 75ab45ac3c6589496bd04d8c6070bb7c9c60daab
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Jul 2 20:35:23 2019 +0800

    [balsheet-pnl] change definition of maxindent
    
    previous would find deepest account; it should really find deepest
    selected account.

diff --git a/gnucash/report/standard-reports/balsheet-pnl.scm b/gnucash/report/standard-reports/balsheet-pnl.scm
index fd3de167d..955b8127f 100644
--- a/gnucash/report/standard-reports/balsheet-pnl.scm
+++ b/gnucash/report/standard-reports/balsheet-pnl.scm
@@ -866,7 +866,7 @@ also show overall period profit & loss."))
          (multicol-table-right (if enable-dual-columns?
                                    (gnc:make-html-table)
                                    multicol-table-left))
-         (maxindent (gnc-account-get-tree-depth (gnc-get-current-root-account))))
+         (maxindent (apply max (cons 0 (map gnc-account-get-current-depth accounts)))))
 
     (gnc:html-document-set-title!
      doc (with-output-to-string

commit 6f217165c4b90f34dcede27c6c1f236191bec7e0
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jun 29 23:33:09 2019 +0800

    [owner-report] fix code to set date to 'today'
    
    code sets date-option to today. it fails to set the default-value. the
    date will reset when user click 'reset options', and this commit
    ensures the 'today' date remains the default date.

diff --git a/gnucash/report/business-reports/owner-report.scm b/gnucash/report/business-reports/owner-report.scm
index 0c466af4b..b6a0a48ce 100644
--- a/gnucash/report/business-reports/owner-report.scm
+++ b/gnucash/report/business-reports/owner-report.scm
@@ -549,10 +549,9 @@
    gnc:*report-options* gnc:pagename-general
    optname-from-date optname-to-date "a")
   ;; Use a default report date of 'today'
-  (gnc:option-set-value (gnc:lookup-option gnc:*report-options*
-                                           gnc:pagename-general
-                                           optname-to-date)
-                        (cons 'relative 'today))
+  (gnc:option-set-default-value
+   (gnc:lookup-option gnc:*report-options* gnc:pagename-general optname-to-date)
+   (cons 'relative 'today))
 
   (gnc:register-inv-option
    (gnc:make-simple-boolean-option

commit 3a927ce2ac88380746da6ed073aa692240a9e118
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jun 29 14:18:59 2019 +0800

    [customer-summary] fix no-owner sorting of entries
    
    Previous 9ed0174cb would place any entry with customername == "No
    Customer" last, including genuine customers with this particular
    name. This commit modifies to test on presence of owner-report-url to
    detect owner/no-owner entries. This is reliable for this report.

diff --git a/gnucash/report/business-reports/customer-summary.scm b/gnucash/report/business-reports/customer-summary.scm
index fb637897d..460d999a8 100644
--- a/gnucash/report/business-reports/customer-summary.scm
+++ b/gnucash/report/business-reports/customer-summary.scm
@@ -428,14 +428,14 @@
                (op (if (eq? sort-order 'descend) > <)))
           (define (<? key)
             (case key
-              ;; customername sorting is handled differently;
-              ;; this conditional ensures "No Customer" lines
-              ;; are printed last.
+              ;; customername sorting is handled differently; this
+              ;; conditional ensures "No Customer" entries,
+              ;; i.e. without owner-report url, are printed last.
               ((customername)
                (lambda (a b)
                  (cond
-                  ((string=? (vector-ref b 0) (_ "No Customer")) #t)
-                  ((string=? (vector-ref a 0) (_ "No Customer")) #f)
+                  ((vector-ref b 6) #t)
+                  ((vector-ref a 6) #f)
                   (else (str-op (vector-ref a 0) (vector-ref b 0))))))
               ;; currency sorting always alphabetical a-z
               ((currency)



Summary of changes:
 .../report/business-reports/customer-summary.scm   | 10 ++++----
 gnucash/report/business-reports/owner-report.scm   |  7 +++---
 .../report/standard-reports/average-balance.scm    | 27 +++++++++++++++++++---
 gnucash/report/standard-reports/balsheet-pnl.scm   |  2 +-
 4 files changed, 33 insertions(+), 13 deletions(-)



More information about the gnucash-changes mailing list