From 7cc64c04a56b30b4c04fe4cf7d3399dcf58c4971 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 19 Jan 2009 22:30:34 -0400 Subject: Don't calculate a reflexive price if a commodity has been marked as NOMARKET. --- src/commodity.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') 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(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 hist = history(price.commodity()); if (! hist) { std::pair result -- cgit v1.2.3