diff options
-rw-r--r-- | src/amount.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/amount.cc b/src/amount.cc index 9817f464..a5c54ce6 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -743,21 +743,22 @@ amount_t::value(const optional<datetime_t>& moment, optional<price_point_t> point; optional<commodity_t&> comm(in_terms_of); - if (comm && commodity().referent() == comm->referent()) { - return *this; - } - else if (has_annotation() && annotation().price) { + if (has_annotation() && annotation().price) { if (annotation().has_flags(ANNOTATION_PRICE_FIXATED)) { point = price_point_t(); point->price = *annotation().price; } - else if (! in_terms_of) { + else if (! comm) { comm = annotation().price->commodity(); } } if (! point) { + if (comm && commodity().referent() == comm->referent()) + return *this; + point = commodity().find_price(comm, moment); + // Whether a price was found or not, check whether we should attempt // to download a price from the Internet. This is done if (a) no // price was found, or (b) the price is "stale" according to the |