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 591117 - Cash Flow Report's "Depth: All" Option is Broken
Cash Flow Report's "Depth: All" Option is Broken
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.2.9
Other Linux
: Normal major
: ---
Assigned To: Andreas Köhler
Andreas Köhler
Depends on:
Blocks:
 
 
Reported: 2009-08-08 03:26 UTC by David Eisner
Modified: 2018-06-29 22:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of problem scenario (57.51 KB, image/png)
2009-08-08 03:27 UTC, David Eisner
  Details
patch to fix handling of Account Display Depth 'All' option (839 bytes, patch)
2009-08-08 04:34 UTC, David Eisner
committed Details | Review

Description David Eisner 2009-08-08 03:26:29 UTC
The Cash Flow report option dialog contains an "Account Display Depth" picklist which can be used to select a numeric value from 1 to 6, or the value "All". I can find no documentation for this option, but it appears intended to let the user truncate the report's account listing to only those accounts whose depth in the account tree is <= the chosen display depth.

Due to a bug in the report implementation, the setting does not work as intended if no top-level account has been selected.  Consider the scenario depicted in the screenshot which I will post.  Two accounts are selected, one at depth 2 and one at depth 3 (where the top level accounts are level 1).  The "Account Display Depth" is set to "All". The expected behavior is that the two selected accounts should be displayed under the "Selected Accounts" label in the generated report. However, no accounts are displayed.  If the Account Display Depth is changed from "All" to "3", however, both accounts are displayed, as expected.

The problem occurs in cash-flow.scm. The handling of the "All" setting for Account Display Depth involves setting the depth threshold to the maximum depth of all selected accounts, at line 215. But the function used to make the calculation, accounts-get-children-depth, actually computes the maximum of the depths of the subtrees rooted at each account in the accounts argument.  In the test case, because neither of the two accounts has children, this maximum depth is 1.
Comment 1 David Eisner 2009-08-08 03:27:28 UTC
Created attachment 140172 [details]
screenshot of problem scenario
Comment 2 David Eisner 2009-08-08 04:33:21 UTC
Here's a patch.  By the way, in my previous comment, what I should have said is that the handling of the "All" setting for Account Display Depth involves setting the depth threshold to the maximum depth of all selected accounts *and their children*, at line 215.
Comment 3 David Eisner 2009-08-08 04:34:55 UTC
Created attachment 140176 [details] [review]
patch to fix handling of Account Display Depth 'All' option
Comment 4 Christian Stimming 2009-09-14 07:34:27 UTC
Comment on attachment 140176 [details] [review]
patch to fix handling of Account Display Depth 'All' option

Patch looks good, please apply.
Comment 5 Phil Longstaff 2009-09-14 23:53:05 UTC
Comment on attachment 140176 [details] [review]
patch to fix handling of Account Display Depth 'All' option

r18316
Comment 6 John Ralls 2018-06-29 22:26:13 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=591117. Please update any external references or bookmarks.