summaryrefslogtreecommitdiff
path: root/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-07-31 02:36:20 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-07-31 02:36:20 -0400
commit3273be3dccbdd56035b588f5e7edc5a26544f841 (patch)
tree7f37c898e924b09485b434780ff253ba67ad3d1a /item.cc
parentc06fad4291d385c7021dc1876a1d06d52a0508c1 (diff)
downloadfork-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.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/item.cc b/item.cc
index c85ad9ba..11203c10 100644
--- a/item.cc
+++ b/item.cc
@@ -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