After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793278 - wrong data in charts with accumulated values (like "net-linechart", "net-barchart" and "liabilities barchart")
wrong data in charts with accumulated values (like "net-linechart", "net-barc...
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.7.x
Other Linux
: Normal major
: ---
Assigned To: gnucash-reports-maint
gnucash-reports-maint
Depends on:
Blocks:
 
 
Reported: 2018-02-07 19:49 UTC by Di Mang
Modified: 2018-06-30 00:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Liability Barchart (70.40 KB, image/png)
2018-02-07 19:49 UTC, Di Mang
Details
datafile for testing (4.78 KB, application/x-gzip)
2018-02-08 08:42 UTC, Di Mang
Details

Description Di Mang 2018-02-07 19:49:25 UTC
Created attachment 368096 [details]
Liability Barchart

The reports with accumulated values, like "net-linechart", "net-barchart" and "liabilities barchart", are displayed incorrectly. The values ​​before the start date are ignored  (see attachment).

This bug was caused by commit "766e74096+"

Titel: "bugfix incorrect min-date handling".
Description: "This bugfix affects net-linechart and net-barchart - assumes the min-date for dates must be 0. Net worth charts straddling the date 01-01-1970 were incorrect. I'll fix in time64-ftw as well."
Diff: "
---------------- src/report/report-system/report-collectors.scm ----------------
index ad3ae5369..b4415e5d8 100644
@@ -155,7 +155,7 @@
     (list min-date max-date datepairs)))
 
 (define (category-report-dates-accumulate dates)
-  (let* ((min-date (gnc:secs->timepair 0))
+  (let* ((min-date (decdate (car (list-min-max dates gnc:timepair-lt)) DayDelta))
"

As a simple solution, we can undo this change.
Comment 1 Di Mang 2018-02-07 20:00:02 UTC
Link to commit at GitHub (on 28 Dec 2017):

https://github.com/Gnucash/gnucash/commit/766e74096ff6ca61680bee1e7f9d54fb487a91e3
Comment 2 Chris 2018-02-07 22:58:28 UTC
I created this commit to fix a bug described in commit. I think the bug is somewhere else, tbh.

Would you mind running the other reports 
"Income Chart"
"Expense Chart"
"Asset Chart"
"Liability Chart"
"Income/Expense Linechart"
"Income/Expense Barchart"
"Net Worth Linechart"
"Net Worth Barchart"

for the same time period and compare results? I suspect there's an incorrect flag somewhere.
Comment 3 Chris 2018-02-07 23:27:41 UTC
Alternatively this bug could be fixed by changing the min-date to #f and testing it separately when it's used. This is the scheme way of handling special cases(I think).

gnucash/report/report-system/report-collectors.scm | 6 ++++--
-------------------------------------------------------------

@@ -93,7 +93,9 @@
          (slotset (make-slotset (lambda (split)
                                   (let* ((date (split->date split))
                                          (interval-index (binary-search-lt (lambda (pair date)
-                                                                             (<= (car pair) date))
+                                                                             (or (not (car pair))
+                                                                                 (<= (car pair) date)))
                                                                            date
                                                                            date-vector))
                                          (interval (vector-ref date-vector interval-index)))
@@ -155,7 +157,7 @@
     (list min-date max-date dates)))
 
 (define (category-report-dates-accumulate dates)
-  (let* ((min-date (decdate (car (list-min-max dates <)) DayDelta))
+  (let* ((min-date #f)
          (max-date (cdr (list-min-max dates <)))
          (datepairs (reverse! (cdr (fold (lambda (next acc)
                                            (let ((prev (car acc))
Comment 4 Chris 2018-02-08 00:14:59 UTC
Plus we need to add your datafile as a test case
Comment 5 Di Mang 2018-02-08 08:42:23 UTC
Created attachment 368129 [details]
datafile for testing
Comment 6 Chris 2018-02-08 14:10:16 UTC
Ok I think this is the right fix. Apologies for creating this bug.
https://github.com/Gnucash/gnucash/pull/276
Comment 7 Di Mang 2018-02-08 14:41:49 UTC
Hi Chris,

thanks a lot for the quick bug fix!

I would like to know more about the technical side of reporting in Gnucash. 
What can I start with? Can you recommend relevant sources for this?

DM
Comment 8 Di Mang 2018-02-08 14:44:01 UTC
I am also interested in how I can define and execute the test cases... 
Thank you in advance!
Comment 9 Chris 2018-02-08 15:05:36 UTC
To start with everything on https://wiki.gnucash.org/wiki/Custom_Reports

Resources that help learn scheme:
- HtDP free book
- SICP free book
- SICP videos
- DrRacket tutorial
- Working on your pet report project in Gnucash
- and of course the Gnucash dev team

I'm afraid there's no shortcut!

For the unit test you'll need a CMake build environment
Then cd build, ninja check
Comment 10 Chris 2018-02-16 00:23:08 UTC
fixed in maint and unstable.
Diman hope you haven't given up on scheme :)
Comment 11 Di Mang 2018-02-16 11:34:04 UTC
Hello Chris, 
thanks for fixing! I am still interested in scheme and will look at it later.
DM
Comment 12 John Ralls 2018-06-30 00:04:22 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=793278. Please update any external references or bookmarks.