Remove getOverlaps function

Since the Intervals are all in order, we can use getTracked directly to
get overlapping intervals without the need to copy the Intervals into
another vector.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
Shaun Ruffell 2020-06-07 23:12:57 -05:00 committed by Thomas Lauf
parent 7bc511bc73
commit 356f20c9de
3 changed files with 2 additions and 20 deletions

View file

@ -454,21 +454,3 @@ std::string minimalDelta (const Datetime& left, const Datetime& right)
}
////////////////////////////////////////////////////////////////////////////////
std::vector <Interval> getOverlaps (
Database& database,
const Rules& rules,
const Interval& interval)
{
Interval range_filter {interval.start, interval.end};
auto tracked = getTracked (database, rules, range_filter);
std::vector <Interval> overlaps;
for (auto& track : tracked)
if (interval.overlaps (track))
overlaps.push_back (track);
return overlaps;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -80,7 +80,6 @@ int quantizeToNMinutes (int, int);
bool findHint (const CLI&, const std::string&);
std::string minimalDelta (const Datetime&, const Datetime&);
std::vector <Interval> getOverlaps (Database&, const Rules&, const Interval&);
// log.cpp
void enableDebugMode (bool);

View file

@ -97,7 +97,8 @@ static void autoAdjust (
Database& database,
Interval& interval)
{
auto overlaps = getOverlaps (database, rules, interval);
Interval overlaps_filter {interval.start, interval.end};
auto overlaps = getTracked (database, rules, overlaps_filter);
if (overlaps.empty ())
{