summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2016-03-14 12:03:24 -0700
committerJohn Wiegley <johnw@newartisans.com>2016-03-14 12:03:24 -0700
commit16c2b8d58d98c41a8b9093116dfa34d5da71b44a (patch)
tree5b307f3cca940fc7b0c29c87c5421bfa5c61c506 /src
parenta505538e100db388cb692d38678f1e8a5061d868 (diff)
parent97ec24544e783abd9edecdc13e8deba99baee47b (diff)
downloadfork-ledger-16c2b8d58d98c41a8b9093116dfa34d5da71b44a.tar.gz
fork-ledger-16c2b8d58d98c41a8b9093116dfa34d5da71b44a.tar.bz2
fork-ledger-16c2b8d58d98c41a8b9093116dfa34d5da71b44a.zip
Merge pull request #449 from ppickfor/next
Use interval start date (period from/since) to initialize first period.
Diffstat (limited to 'src')
-rw-r--r--src/filters.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 1d7832ca..8aa1218b 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -982,10 +982,12 @@ void interval_posts::flush()
std::stable_sort(all_posts.begin(), all_posts.end(),
sort_posts_by_date());
- // Determine the beginning interval by using the earliest post
- if (all_posts.size() > 0 && all_posts.front() &&
- ! interval.find_period(all_posts.front()->date()))
- throw_(std::logic_error, _("Failed to find period for interval report"));
+ // only if the interval has no start use the earliest post
+ if (!(interval.begin() && interval.find_period(*interval.begin())))
+ // Determine the beginning interval by using the earliest post
+ if (all_posts.size() > 0 && all_posts.front()
+ && !interval.find_period(all_posts.front()->date()))
+ throw_(std::logic_error, _("Failed to find period for interval report"));
// Walk the interval forward reporting all posts within each one
// before moving on, until we reach the end of all_posts