diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-15 15:41:24 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-15 15:41:24 -0400 |
commit | 03219d910f527b6a4c5f563aab6152145a51e0fa (patch) | |
tree | 8ed61d455944fce36caa566de5a9492d749cade0 /src/filters.cc | |
parent | 36b96c47ac79fd124d1ba4f53b4721179782985f (diff) | |
download | ledger-03219d910f527b6a4c5f563aab6152145a51e0fa.tar.gz ledger-03219d910f527b6a4c5f563aab6152145a51e0fa.tar.bz2 ledger-03219d910f527b6a4c5f563aab6152145a51e0fa.zip |
Added xact_t::count member
This allows reports to access the "whicheth" index of the reported
transaction. It's used mainly by the --average report, which divides
the running total by this count to get the arithmetic mean.
Diffstat (limited to 'src/filters.cc')
-rw-r--r-- | src/filters.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/filters.cc b/src/filters.cc index f97e58d0..8d8589e4 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -186,8 +186,13 @@ void calc_xacts::operator()(xact_t& xact) try { xact_t::xdata_t& xdata(xact.xdata()); - if (last_xact && last_xact->has_xdata()) + if (last_xact) { + assert(last_xact->has_xdata()); add_or_set_value(xdata.total, last_xact->xdata().total); + xdata.count = last_xact->xdata().count + 1; + } else { + xdata.count = 1; + } xact.add_to_value(xdata.total, amount_expr); |