From 887f429ae40934c145e03b03cc452e6af4457c0f Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 28 Feb 2012 01:37:29 -0600 Subject: Added debug code for debugging interval reports --- src/filters.h | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/filters.h') diff --git a/src/filters.h b/src/filters.h index d207d842..2e51c91c 100644 --- a/src/filters.h +++ b/src/filters.h @@ -728,21 +728,44 @@ public: empty_account = &temps.create_account(_("")); } - void report_subtotal(const date_interval_t& interval); + void report_subtotal(const date_interval_t& ival); + +#if defined(DEBUG_ON) + void debug_interval(const date_interval_t& ival) { + if (ival.start) + DEBUG("filters.interval", "start = " << *ival.start); + else + DEBUG("filters.interval", "no start"); + + if (ival.finish) + DEBUG("filters.interval", "finish = " << *ival.finish); + else + DEBUG("filters.interval", "no finish"); + } +#endif virtual void flush() { if (last_post && interval.duration) { - if (last_interval && interval != last_interval) + DEBUG("filters.interval", "There is a last_post and an interval.duration"); + if (interval != last_interval) { +#if defined(DEBUG_ON) + DEBUG("filters.interval", "interval != last_interval, so reporting"); + DEBUG("filters.interval", "interval is:"); + debug_interval(interval); + DEBUG("filters.interval", "last_interval is:"); + debug_interval(last_interval); +#endif report_subtotal(last_interval); + } subtotal_posts::flush(); } } virtual void operator()(post_t& post); virtual void clear() { - interval = start_interval; + interval = start_interval; last_interval = date_interval_t(); - last_post = NULL; + last_post = NULL; subtotal_posts::clear(); create_accounts(); -- cgit v1.2.3