From 3ec09f9be13f5f295c1e24c08c4e009b0b480b21 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 2 Dec 2019 21:59:19 -0600 Subject: [PATCH] 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. --- src/Interval.h | 1 + src/helper.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Interval.h b/src/Interval.h index 95735956..fc9ae89c 100644 --- a/src/Interval.h +++ b/src/Interval.h @@ -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; diff --git a/src/helper.cpp b/src/helper.cpp index 148499f1..905ae810 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -446,7 +446,8 @@ std::vector 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 overlaps;