summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-16 03:09:13 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-16 03:09:13 -0500
commit49ec40a939ac5cd46f7ea85e03896e89377890d2 (patch)
treebc982c086eb8462565f3a7316a48a178b11a05a0
parentecd2ece1957b96845ebc7e863fc9ff8be3c5361d (diff)
downloadfork-ledger-49ec40a939ac5cd46f7ea85e03896e89377890d2.tar.gz
fork-ledger-49ec40a939ac5cd46f7ea85e03896e89377890d2.tar.bz2
fork-ledger-49ec40a939ac5cd46f7ea85e03896e89377890d2.zip
pricedb was outputting redundant prices
Fixes #704
-rw-r--r--src/history.cc2
-rw-r--r--src/iterators.cc2
-rw-r--r--test/regress/8CE88DB4.test11
3 files changed, 14 insertions, 1 deletions
diff --git a/src/history.cc b/src/history.cc
index 3767c1df..f1e88401 100644
--- a/src/history.cc
+++ b/src/history.cc
@@ -212,9 +212,11 @@ void commodity_history_t::map_prices(function<void(datetime_t,
else
price.set_commodity(const_cast<commodity_t&>(*get(namemap, sv)));
DEBUG("history.map", "Inverted price is " << price);
+ DEBUG("history.map", "fn(" << when << ", " << price << ")");
fn(when, price);
}
} else {
+ DEBUG("history.map", "fn(" << when << ", " << pair.second << ")");
fn(when, pair.second);
}
}
diff --git a/src/iterators.cc b/src/iterators.cc
index 8ca5922b..acbb581f 100644
--- a/src/iterators.cc
+++ b/src/iterators.cc
@@ -138,7 +138,7 @@ void posts_commodities_iterator::reset(journal_t& journal)
commodity_t& comm(post->amount.commodity());
if (comm.flags() & COMMODITY_NOMARKET)
continue;
- commodities.insert(&comm);
+ commodities.insert(&comm.referent());
}
foreach (commodity_t * comm, commodities)
diff --git a/test/regress/8CE88DB4.test b/test/regress/8CE88DB4.test
new file mode 100644
index 00000000..52fe0a9b
--- /dev/null
+++ b/test/regress/8CE88DB4.test
@@ -0,0 +1,11 @@
+2010-01-01 * Test
+ Expenses:Food 100.00 EUR
+ Assets:Cash -100.00 EUR
+
+2011-07-30 * Exchange EUR to BAM
+ Assets:Cash -22.00 EUR
+ Assets:Cash 44.00 BAM
+
+test pricedb
+P 2011/07/30 00:00:00 EUR 2.00 BAM
+end test