GNOME Bugzilla – Bug 793278
wrong data in charts with accumulated values (like "net-linechart", "net-barchart" and "liabilities barchart")
Last modified: 2018-06-30 00:04:22 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.
Link to commit at GitHub (on 28 Dec 2017): https://github.com/Gnucash/gnucash/commit/766e74096ff6ca61680bee1e7f9d54fb487a91e3
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.
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))
Plus we need to add your datafile as a test case
Created attachment 368129 [details] datafile for testing
Ok I think this is the right fix. Apologies for creating this bug. https://github.com/Gnucash/gnucash/pull/276
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
I am also interested in how I can define and execute the test cases... Thank you in advance!
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
fixed in maint and unstable. Diman hope you haven't given up on scheme :)
Hello Chris, thanks for fixing! I am still interested in scheme and will look at it later. DM
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.