diff options
author | John Wiegley <johnw@newartisans.com> | 2016-11-12 18:51:11 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2016-11-12 18:51:11 -0800 |
commit | 960f4e809f983263a061b40dd3cbd9408c5f8e1f (patch) | |
tree | 33f4e14b0c6123a50f58d1bdfb148a902bc3b190 /src/output.cc | |
parent | f1dc15a4c7de39945cda45fd93e11020921c5c2b (diff) | |
download | fork-ledger-960f4e809f983263a061b40dd3cbd9408c5f8e1f.tar.gz fork-ledger-960f4e809f983263a061b40dd3cbd9408c5f8e1f.tar.bz2 fork-ledger-960f4e809f983263a061b40dd3cbd9408c5f8e1f.zip |
Fix 1043
Diffstat (limited to 'src/output.cc')
-rw-r--r-- | src/output.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/output.cc b/src/output.cc index 77083450..418140ae 100644 --- a/src/output.cc +++ b/src/output.cc @@ -34,6 +34,7 @@ #include "output.h" #include "xact.h" #include "post.h" +#include "item.h" #include "account.h" #include "session.h" #include "report.h" @@ -329,21 +330,26 @@ void report_tags::flush() } } -void report_tags::operator()(post_t& post) +void report_tags::gather_metadata(item_t& item) { - if (post.metadata) { - foreach (const item_t::string_map::value_type& data, *post.metadata) { - string tag=data.first; - if (report.HANDLED(values) && (data.second).first) { - tag+=": "+ (data.second).first.get().to_string(); - } + if (item.metadata) + foreach (const item_t::string_map::value_type& data, *item.metadata) { + string tag(data.first); + if (report.HANDLED(values) && data.second.first) + tag += ": " + data.second.first.get().to_string(); + std::map<string, std::size_t>::iterator i = tags.find(tag); if (i == tags.end()) - tags.insert(tags_pair(tag, 1)); + tags.insert(tags_pair(tag, 1)); else - (*i).second++; + (*i).second++; } - } +} + +void report_tags::operator()(post_t& post) +{ + gather_metadata(*post.xact); + gather_metadata(post); } void report_commodities::flush() |