diff options
-rw-r--r-- | src/commodity.cc | 4 | ||||
-rw-r--r-- | src/commodity.h | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/commodity.cc b/src/commodity.cc index 7aecc2bb..61fd0fe5 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -264,6 +264,10 @@ commodity_t::varied_history_t::find_price(const commodity_t& source, if (comm == source) continue; + // Only value secondary commodities in terms of primary ones + if (! commodity && ! comm.has_flags(COMMODITY_PRIMARY)) + continue; + DEBUG_INDENT("commodity.prices.find", indent + 1); DEBUG("commodity.prices.find", "searching for price via commodity '" << comm << "'"); diff --git a/src/commodity.h b/src/commodity.h index 05dc3395..483d98b0 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -351,7 +351,8 @@ public: , const int indent = 0 #endif ) const { - if (base->varied_history && ! has_flags(COMMODITY_WALKED)) { + if (! has_flags(COMMODITY_WALKED) && base->varied_history && + (commodity || ! has_flags(COMMODITY_PRIMARY))) { const_cast<commodity_t&>(*this).add_flags(COMMODITY_WALKED); optional<price_point_t> point = base->varied_history->find_price(*this, commodity, moment, oldest |