diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-19 00:41:32 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-19 00:41:32 -0500 |
commit | cd50fe054794d89253fce26daa685e2043428873 (patch) | |
tree | 467834b12d2bf0b446915c4069b98c018c3a7ea1 | |
parent | 60a281a55a2fd009723c291c6e665b0de743f062 (diff) | |
download | fork-ledger-cd50fe054794d89253fce26daa685e2043428873.tar.gz fork-ledger-cd50fe054794d89253fce26daa685e2043428873.tar.bz2 fork-ledger-cd50fe054794d89253fce26daa685e2043428873.zip |
More improvements to nail_down; fixes #715
-rw-r--r-- | src/report.cc | 6 | ||||
-rw-r--r-- | test/regress/BFD3FBE1.test | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/report.cc b/src/report.cc index 28836d0f..21fc9c1b 100644 --- a/src/report.cc +++ b/src/report.cc @@ -813,10 +813,12 @@ value_t report_t::fn_nail_down(call_scope_t& args) switch (arg0.type()) { case value_t::AMOUNT: { amount_t tmp(arg0.as_amount()); - if (tmp.has_commodity() && ! arg1.is_null()) { + if (tmp.has_commodity() && ! tmp.is_null() && ! tmp.is_realzero()) { + arg1 = arg1.strip_annotations(keep_details_t()).to_amount(); expr_t value_expr(is_expr(arg1) ? as_expr(arg1) : - expr_t::op_t::wrap_value(arg1.unrounded() / arg0)); + expr_t::op_t::wrap_value(arg1.unrounded() / + arg0.number())); std::ostringstream buf; value_expr.print(buf); value_expr.set_text(buf.str()); diff --git a/test/regress/BFD3FBE1.test b/test/regress/BFD3FBE1.test new file mode 100644 index 00000000..5b2f8b42 --- /dev/null +++ b/test/regress/BFD3FBE1.test @@ -0,0 +1,17 @@ +2011-01-01 * Opening balance + Assets:Investment 100 "AAA" @ 16.58900489 EUR + Assets:Investments 5 "BBB" @ 24.79900855 EUR + Equity:Opening balance + +2011-02-10 * Reimbursement: Taxi / Subway / Bus / Train + Assets:A 1.59 GBP + Assets:B -1.80 EUR @ 0.884955752212389381 GBP + +test reg -X EUR -H +11-Jan-01 Opening balance Assets:Investment 1658.90 EUR 1658.90 EUR + Assets:Investments 124.00 EUR 1782.90 EUR + Equity:Opening balance -1782.90 EUR 0 +11-Feb-10 Reimbursement: Taxi.. <Adjustment> -0.01 EUR -0.01 EUR + Assets:A 1.80 EUR 1.80 EUR + Assets:B -1.80 EUR 0 +end test |