summaryrefslogtreecommitdiff
path: root/src/chain.cc
diff options
context:
space:
mode:
authorRahix <rahix@rahix.de>2020-05-12 20:03:06 +0200
committerJohn Wiegley <johnw@newartisans.com>2020-07-21 14:50:01 -0700
commit220f137ff69c7fcde430a09e86470636910330ef (patch)
tree63bed74f420e6fce0425571457fd22dca76c9e5a /src/chain.cc
parentf1e8a0a42f9b0d2b11201a2b67bea6f60e37c76f (diff)
downloadfork-ledger-220f137ff69c7fcde430a09e86470636910330ef.tar.gz
fork-ledger-220f137ff69c7fcde430a09e86470636910330ef.tar.bz2
fork-ledger-220f137ff69c7fcde430a09e86470636910330ef.zip
collapse_posts: Use --depth as the collapse_depth
Use the value from --depth as the collapse_depth for --collapse.
Diffstat (limited to 'src/chain.cc')
-rw-r--r--src/chain.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/chain.cc b/src/chain.cc
index ed795007..ef98a867 100644
--- a/src/chain.cc
+++ b/src/chain.cc
@@ -193,10 +193,16 @@ post_handler_ptr chain_post_handlers(post_handler_ptr base_handler,
// collapse_posts causes xacts with multiple posts to appear as xacts
// with a subtotaled post for each commodity used.
- if (report.HANDLED(collapse))
+ if (report.HANDLED(collapse)) {
+ unsigned short collapse_depth = 0;
+ if (report.HANDLED(depth_))
+ collapse_depth = lexical_cast<int>(report.HANDLER(depth_).str());
+
handler.reset(new collapse_posts(handler, report, expr,
display_predicate, only_predicate,
- report.HANDLED(collapse_if_zero)));
+ report.HANDLED(collapse_if_zero),
+ collapse_depth));
+ }
// subtotal_posts combines all the posts it receives into one subtotal
// xact, which has one post for each commodity in each account.