From 26de701a4e57fc788a3b4f120fd606b01e673d5c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 25 Sep 2004 17:59:14 -0400 Subject: corrected the deviation report (-D) when -V is also being used --- config.cc | 8 ++++---- ledger.texi | 3 --- valexpr.cc | 7 ------- walk.cc | 8 ++++++-- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/config.cc b/config.cc index 5a273b3d..4153f213 100644 --- a/config.cc +++ b/config.cc @@ -586,16 +586,16 @@ OPT_BEGIN(average, "A") { } OPT_END(average); OPT_BEGIN(deviation, "D") { - config.total_expr = std::string("DM") + config.total_expr; + config.total_expr = std::string("t-M") + config.total_expr; } OPT_END(deviation); OPT_BEGIN(trend, "X") { - config.total_expr = std::string("MDM") + config.total_expr; + config.total_expr = std::string("M(t-M") + config.total_expr + ")"; } OPT_END(trend); OPT_BEGIN(weighted_trend, "Z") { - config.total_expr = (std::string("MD(M(") + config.total_expr + - ")/(1+(((m-d)/(30*86400))<0?0:((m-d)/(30*86400)))))"); + config.total_expr = (std::string("M(t-(M(") + config.total_expr + + ")/(1+(((m-d)/(30*86400))<0?0:((m-d)/(30*86400))))))"); } OPT_END(weighted_trend); } // namespace ledger diff --git a/ledger.texi b/ledger.texi index 4b854e8b..3d5acd26 100644 --- a/ledger.texi +++ b/ledger.texi @@ -967,9 +967,6 @@ Strips the commodity from the argument. @item M The median of the argument; @samp{Mx} is the same as @samp{x/n}. -@item D -The deviation of the argument; @samp{Dx} is the same as @samp{x-x/n}. - @item P The present market value of the argument. The syntax @samp{P(x,d)} is supported, which yields the market value at time @samp{d}. diff --git a/valexpr.cc b/valexpr.cc index 7eb82494..eb2b08f9 100644 --- a/valexpr.cc +++ b/valexpr.cc @@ -505,13 +505,6 @@ value_expr_t * parse_value_term(std::istream& in) node->left = parse_value_term(in); break; - case 'D': { - node.reset(new value_expr_t(value_expr_t::O_SUB)); - node->left = parse_value_term("a"); - node->right = parse_value_term(in); - break; - } - case 'P': node.reset(new value_expr_t(value_expr_t::F_VALUE)); if (peek_next_nonws(in) == '(') { diff --git a/walk.cc b/walk.cc index 739ad2ef..d6490d99 100644 --- a/walk.cc +++ b/walk.cc @@ -38,8 +38,10 @@ void sort_transactions::flush() for (transactions_deque::iterator i = transactions.begin(); i != transactions.end(); - i++) + i++) { + transaction_xdata(**i).dflags &= ~TRANSACTION_SORT_CALC; (*handler)(**i); + } transactions.clear(); @@ -405,8 +407,10 @@ void walk_accounts(account_t& account, sort_accounts(account, sort_order, accounts); for (accounts_deque::const_iterator i = accounts.begin(); i != accounts.end(); - i++) + i++) { + account_xdata(**i).dflags &= ~ACCOUNT_SORT_CALC; walk_accounts(**i, handler, sort_order); + } } else { for (accounts_map::const_iterator i = account.accounts.begin(); i != account.accounts.end(); -- cgit v1.2.3