mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
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:
parent
7bc511bc73
commit
356f20c9de
3 changed files with 2 additions and 20 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue