chain_xact_handlers now always operators the same

Previously, account-wise reports used a subset of the total number of
transaction filters, but this could cause confusing results, and made
some reports immpossible (such as account-wise monthly averages).
This commit is contained in:
John Wiegley 2009-02-15 20:45:09 -04:00
parent cb6b6e8b67
commit 5d4ac67920
3 changed files with 72 additions and 79 deletions

View file

@ -36,13 +36,10 @@
namespace ledger {
xact_handler_ptr chain_xact_handlers(report_t& report,
xact_handler_ptr base_handler,
const bool handle_individual_xacts)
xact_handler_ptr base_handler)
{
xact_handler_ptr handler(base_handler);
// format_xacts write each xact received to the output stream.
if (handle_individual_xacts) {
// truncate_entries cuts off a certain number of _entries_ from being
// displayed. It does not affect calculation.
if (report.HANDLED(head_) || report.HANDLED(tail_))
@ -119,7 +116,6 @@ xact_handler_ptr chain_xact_handlers(report_t& report,
report.session.master.get()));
handler.reset(new sort_xacts(handler, "date"));
}
}
// invert_xacts inverts the value of the xacts it receives.
if (report.HANDLED(invert))

View file

@ -88,11 +88,8 @@ typedef shared_ptr<item_handler<xact_t> > xact_handler_ptr;
typedef shared_ptr<item_handler<account_t> > acct_handler_ptr;
class report_t;
xact_handler_ptr
chain_xact_handlers(report_t& report,
xact_handler_ptr base_handler,
const bool handle_individual_xacts = true);
xact_handler_ptr chain_xact_handlers(report_t& report,
xact_handler_ptr base_handler);
} // namespace ledger

View file

@ -113,9 +113,9 @@ void report_t::sum_all_accounts()
expr.set_context(this);
journal_xacts_iterator walker(*session.journal.get());
pass_down_xacts
(chain_xact_handlers(*this, xact_handler_ptr(new set_account_value(expr)),
false), walker);
pass_down_xacts(chain_xact_handlers
(*this, xact_handler_ptr(new set_account_value(expr))),
walker);
expr.mark_uncompiled(); // recompile, throw away xact_t bindings
session.master->calculate_sums(expr);