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:
Shaun Ruffell 2021-05-17 10:12:23 -05:00 committed by Thomas Lauf
parent d133d88247
commit 3ea086dcff
2 changed files with 22 additions and 8 deletions

View file

@ -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 ()));