diff options
-rw-r--r-- | walk.cc | 6 | ||||
-rw-r--r-- | walk.h | 10 |
2 files changed, 10 insertions, 6 deletions
@@ -117,7 +117,7 @@ void set_account_value::operator()(transaction_t& xact) item_handler<transaction_t>::operator()(xact); } -void sort_transactions::flush() +void sort_transactions::post_accumulated_xacts() { std::stable_sort(transactions.begin(), transactions.end(), compare_items<transaction_t>(sort_order)); @@ -129,8 +129,6 @@ void sort_transactions::flush() item_handler<transaction_t>::operator()(**i); } - item_handler<transaction_t>::flush(); - transactions.clear(); } @@ -402,7 +400,7 @@ void interval_transactions::report_subtotal(const std::time_t moment) subtotal_transactions::report_subtotal(); if (sorter) - subtotal_transactions::flush(); + sorter->post_accumulated_xacts(); last_xact = NULL; } @@ -220,7 +220,13 @@ class sort_transactions : public item_handler<transaction_t> delete sort_order; } - virtual void flush(); + virtual void post_accumulated_xacts(); + + virtual void flush() { + post_accumulated_xacts(); + item_handler<transaction_t>::flush(); + } + virtual void operator()(transaction_t& xact) { transactions.push_back(&xact); } @@ -402,7 +408,7 @@ class interval_transactions : public subtotal_transactions transaction_t * last_xact; bool started; - item_handler<transaction_t> * sorter; + sort_transactions * sorter; public: interval_transactions(item_handler<transaction_t> * _handler, |