diff options
author | John Wiegley <johnw@newartisans.com> | 2004-07-31 02:36:20 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-07-31 02:36:20 -0400 |
commit | 3273be3dccbdd56035b588f5e7edc5a26544f841 (patch) | |
tree | 7f37c898e924b09485b434780ff253ba67ad3d1a /item.cc | |
parent | c06fad4291d385c7021dc1876a1d06d52a0508c1 (diff) | |
download | fork-ledger-3273be3dccbdd56035b588f5e7edc5a26544f841.tar.gz fork-ledger-3273be3dccbdd56035b588f5e7edc5a26544f841.tar.bz2 fork-ledger-3273be3dccbdd56035b588f5e7edc5a26544f841.zip |
restore sorting of register reports
Diffstat (limited to 'item.cc')
-rw-r--r-- | item.cc | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -129,6 +129,7 @@ item_t * walk_entries(entries_list::const_iterator begin, subitem->payee = item->payee; subitem->account = (*j)->account; subitem->value = *(*j); + item->value += subitem->value; item->subitems.push_back(subitem); } @@ -163,19 +164,20 @@ item_t * walk_entries(entries_list::const_iterator begin, struct cmp_items { const node_t * sort_order; - cmp_items(const node_t * _sort_order) : sort_order(_sort_order) {} + cmp_items(const node_t * _sort_order) : sort_order(_sort_order) { + assert(sort_order); + } bool operator()(const item_t * left, const item_t * right) const { assert(left); assert(right); - assert(sort_order); return sort_order->compute(left) < sort_order->compute(right); } }; void item_t::sort(const node_t * sort_order) { - std::sort(subitems.begin(), subitems.end(), cmp_items(sort_order)); + std::stable_sort(subitems.begin(), subitems.end(), cmp_items(sort_order)); } } // namespace ledger |