diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-19 22:30:34 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-19 22:30:34 -0400 |
commit | 7cc64c04a56b30b4c04fe4cf7d3399dcf58c4971 (patch) | |
tree | 52794e103861c24d611afd94adba9ce7f32c291c /src | |
parent | ad9a469a2a2881becc934204148f8f14d5a15256 (diff) | |
download | fork-ledger-7cc64c04a56b30b4c04fe4cf7d3399dcf58c4971.tar.gz fork-ledger-7cc64c04a56b30b4c04fe4cf7d3399dcf58c4971.tar.bz2 fork-ledger-7cc64c04a56b30b4c04fe4cf7d3399dcf58c4971.zip |
Don't calculate a reflexive price if a commodity has been marked as NOMARKET.
Diffstat (limited to 'src')
-rw-r--r-- | src/commodity.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/commodity.cc b/src/commodity.cc index 515b3946..ae15d9b0 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -48,7 +48,8 @@ void commodity_t::base_t::history_t::add_price(const commodity_t& source, const amount_t& price, const bool reflexive) { - DEBUG("commodity.prices", "add_price: " << date << ", " << price); + DEBUG("commodity.prices", + "add_price to " << source << " : " << date << ", " << price); history_map::iterator i = prices.find(date); if (i != prices.end()) { @@ -59,7 +60,7 @@ void commodity_t::base_t::history_t::add_price(const commodity_t& source, assert(result.second); } - if (reflexive) { + if (reflexive && ! price.commodity().has_flags(COMMODITY_NOMARKET)) { amount_t inverse(*one / price); inverse.set_commodity(const_cast<commodity_t&>(source)); price.commodity().add_price(date, inverse, false); @@ -82,8 +83,6 @@ void commodity_t::base_t::varied_history_t:: const amount_t& price, const bool reflexive) { - DEBUG("commodity.prices", "varied_add_price: " << date << ", " << price); - optional<history_t&> hist = history(price.commodity()); if (! hist) { std::pair<history_by_commodity_map::iterator, bool> result |