From af94c94a6f927e66cacd71b4625f785372fa438d Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 28 Mar 2011 01:53:15 -0400 Subject: Corrected a transient display order flaw This was harmless, but affected the testability of results. --- src/xact.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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 sorted_amounts_map; + sorted_amounts_map samp; foreach (const balance_t::amounts_map::value_type& pair, bal.amounts) { + std::pair 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); -- cgit v1.2.3