diff options
author | John Wiegley <johnw@newartisans.com> | 2011-03-28 01:53:15 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2011-03-28 01:53:15 -0400 |
commit | af94c94a6f927e66cacd71b4625f785372fa438d (patch) | |
tree | c5a7649d5b069cd89c23798a22ee96bf9015bddb /src/xact.cc | |
parent | 9f4307accda683453a8be0cbb81fd074ccc88991 (diff) | |
download | fork-ledger-af94c94a6f927e66cacd71b4625f785372fa438d.tar.gz fork-ledger-af94c94a6f927e66cacd71b4625f785372fa438d.tar.bz2 fork-ledger-af94c94a6f927e66cacd71b4625f785372fa438d.zip |
Corrected a transient display order flaw
This was harmless, but affected the testability of results.
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/xact.cc b/src/xact.cc index 35d61edd..1acbd0a4 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -325,9 +325,18 @@ bool xact_base_t::finalize() DEBUG("xact.finalize", "there was a null posting"); if (balance.is_balance()) { - bool first = true; const balance_t& bal(balance.as_balance()); + typedef std::map<string, amount_t> sorted_amounts_map; + sorted_amounts_map samp; foreach (const balance_t::amounts_map::value_type& pair, bal.amounts) { + std::pair<sorted_amounts_map::iterator, bool> result = + samp.insert(sorted_amounts_map::value_type(pair.first->mapping_key(), + pair.second)); + assert(result.second); + } + + bool first = true; + foreach (sorted_amounts_map::value_type& pair, samp) { if (first) { null_post->amount = pair.second.negated(); null_post->add_flags(POST_CALCULATED); |