summaryrefslogtreecommitdiff
path: root/src/pool.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-15 04:47:32 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-15 04:58:53 -0500
commit610a3e170994dc3cd3ae0dc989a49e4e7c7fdadf (patch)
treedb4a99b9f5f41047c0c4632452eb944c93a7f07d /src/pool.cc
parentd9fc09097d3ea290a4bdf0c9b46c8ead3e48043c (diff)
downloadfork-ledger-610a3e170994dc3cd3ae0dc989a49e4e7c7fdadf.tar.gz
fork-ledger-610a3e170994dc3cd3ae0dc989a49e4e7c7fdadf.tar.bz2
fork-ledger-610a3e170994dc3cd3ae0dc989a49e4e7c7fdadf.zip
Don't map_prices if price commodity matches source
Fixes #680
Diffstat (limited to 'src/pool.cc')
-rw-r--r--src/pool.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pool.cc b/src/pool.cc
index 0118a97d..d5494352 100644
--- a/src/pool.cc
+++ b/src/pool.cc
@@ -266,6 +266,9 @@ commodity_pool_t::exchange(const amount_t& amount,
amount_t per_unit_cost =
(is_per_unit || amount.is_realzero()) ? cost.abs() : (cost / amount).abs();
+ if (! cost.has_commodity())
+ per_unit_cost.clear_commodity();
+
DEBUG("commodity.prices.add", "exchange: per-unit-cost = " << per_unit_cost);
// Do not record commodity exchanges where amount's commodity has a