diff options
author | John Wiegley <johnw@newartisans.com> | 2009-03-06 04:05:00 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-03-06 04:07:25 -0400 |
commit | f340d50362340c330de83d419eb41c0ede162c49 (patch) | |
tree | 9a30d7bd034c3fa37092725d419f896108536633 /src/account.h | |
parent | 4a0f5f9034dc24c7ae5f0464d407f4cf2279558b (diff) | |
download | fork-ledger-f340d50362340c330de83d419eb41c0ede162c49.tar.gz fork-ledger-f340d50362340c330de83d419eb41c0ede162c49.tar.bz2 fork-ledger-f340d50362340c330de83d419eb41c0ede162c49.zip |
Revised the ways statistics are computed
It is no longer done in calc_posts, but recursively on each account.
This allows value expressions to ask statistical questions, like
"earliest cleared posting?" (TBD) from any specific account, computed
lazily.
Diffstat (limited to 'src/account.h')
-rw-r--r-- | src/account.h | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/account.h b/src/account.h index f161a11f..0fa03dde 100644 --- a/src/account.h +++ b/src/account.h @@ -138,41 +138,34 @@ class account_t : public scope_t struct details_t { - value_t total; - bool calculated; - bool gathered; + value_t total; + bool calculated; + bool gathered; // The following are only calculated if --totals is enabled - std::size_t xacts_count; + std::size_t posts_count; + std::size_t posts_virtuals_count; + std::size_t posts_cleared_count; + std::size_t posts_last_7_count; + std::size_t posts_last_30_count; + std::size_t posts_this_month_count; - std::size_t posts_count; - std::size_t posts_virtuals_count; - std::size_t posts_cleared_count; - std::size_t posts_last_7_count; - std::size_t posts_last_30_count; - std::size_t posts_this_month_count; + date_t earliest_post; + date_t earliest_cleared_post; + date_t latest_post; + date_t latest_cleared_post; - date_t earliest_post; - date_t earliest_cleared_post; - date_t latest_post; - date_t latest_cleared_post; - - xact_t * last_xact; - post_t * last_post; - - std::size_t last_size; + std::size_t last_size; // The following are only calculated if --gather is enabled - std::set<path> filenames; - std::set<string> accounts_referenced; - std::set<string> payees_referenced; + std::set<path> filenames; + std::set<string> accounts_referenced; + std::set<string> payees_referenced; details_t() : calculated(false), gathered(false), - xacts_count(0), - posts_count(0), posts_virtuals_count(0), posts_cleared_count(0), @@ -180,14 +173,6 @@ class account_t : public scope_t posts_last_30_count(0), posts_this_month_count(0), - earliest_post(0), - earliest_cleared_post(0), - latest_post(0), - latest_cleared_post(0), - - last_xact(NULL), - last_post(NULL), - last_size(0) {} details_t& operator+=(const details_t& other); |