Fixed nasty problem related to interval reporting

This commit is contained in:
John Wiegley 2012-02-28 00:08:39 -06:00
parent 6d04f60573
commit fc62402c60
3 changed files with 8 additions and 4 deletions

View file

@ -924,7 +924,7 @@ void interval_posts::operator()(post_t& post)
report_subtotal(last_interval);
if (generate_empty_posts) {
for (++last_interval; interval != last_interval; ++last_interval) {
for (++last_interval; last_interval < interval; ++last_interval) {
// Generate a null posting, so the intervening periods can be
// seen when -E is used, or if the calculated amount ends up being
// non-zero
@ -940,7 +940,7 @@ void interval_posts::operator()(post_t& post)
report_subtotal(last_interval);
}
assert(interval == last_interval);
assert(last_interval <= interval);
} else {
last_interval = interval;
}

View file

@ -732,8 +732,8 @@ public:
virtual void flush() {
if (last_post && interval.duration) {
if (interval.is_valid())
report_subtotal(interval);
if (last_interval && interval != last_interval)
report_subtotal(last_interval);
subtotal_posts::flush();
}
}

View file

@ -553,6 +553,10 @@ public:
return (start == other.start &&
(! start || *start == *other.start));
}
bool operator<(const date_interval_t& other) const {
return (start == other.start &&
(! start || *start < *other.start));
}
operator bool() const {
return is_valid();