mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Allow getTracked to match intervals that intersect with filter
It is not sufficient to stop looking for matching intervals if the
interval start time is before the filter. We really want to make sure
that we pick up any intervals that intersect with the filter.
Fixes bug introduced in (a98bd14
"Simplify getIntervalsById and
getTracked") as part of #423.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
parent
d133d88247
commit
3ea086dcff
2 changed files with 22 additions and 8 deletions
15
src/data.cpp
15
src/data.cpp
|
@ -517,18 +517,17 @@ std::vector <Interval> getTracked (
|
|||
Interval interval = IntervalFactory::fromSerialization(*it);
|
||||
interval.id = ++current_id;
|
||||
|
||||
// Since we are moving backwards in time, and the intervals are in sorted
|
||||
// order, if the filter is after the interval, we know there will be no
|
||||
// more matches
|
||||
if (interval.start < filter.start)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (matchesFilter (interval, filter))
|
||||
{
|
||||
intervals.push_back (std::move (interval));
|
||||
}
|
||||
else if ((interval.start < filter.start) && ! interval.intersects (filter))
|
||||
{
|
||||
// Since we are moving backwards in time, and the intervals are in sorted
|
||||
// order, if the filter is after the interval, we know there will be no
|
||||
// more matches
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
debug (format ("Loaded {1} tracked intervals", intervals.size ()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue