getOverlaps should use non-empty range filter

We can eliminate the need to parse the entire database if we only look for
overlaps based on the latest interval.

Related to issue #245.
This commit is contained in:
Shaun Ruffell 2019-12-02 21:59:19 -06:00 committed by lauft
parent 9c0c27b55b
commit 3ec09f9be1
2 changed files with 3 additions and 1 deletions

View file

@ -35,6 +35,7 @@ class Interval : public Range
{
public:
Interval () = default;
Interval (const Datetime& start, const Datetime& end) : Range (start, end) {}
bool empty () const;
bool hasTag (const std::string&) const;

View file

@ -446,7 +446,8 @@ std::vector <Interval> getOverlaps (
const Rules& rules,
const Interval& interval)
{
Interval range_filter;
Interval range_filter {interval.start, interval.end};
auto tracked = getTracked (database, rules, range_filter);
std::vector <Interval> overlaps;