mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Timeline: Now uses splitInterval
This commit is contained in:
parent
7c51f76954
commit
b2cd2e2953
1 changed files with 2 additions and 21 deletions
|
@ -80,27 +80,8 @@ std::vector <Interval> Timeline::tracked (Rules& rules) const
|
|||
// Open intervals need to be split according to the exclusions.
|
||||
else
|
||||
{
|
||||
|
||||
// Start with a single range from the interval, from which to subtract.
|
||||
std::vector <Range> intervalFragments {interval.range};
|
||||
for (auto& exclusion : exclusions)
|
||||
{
|
||||
std::vector <Range> brokenFragments;
|
||||
for (auto& fragment : intervalFragments)
|
||||
for (auto& broken : fragment.subtract (exclusion))
|
||||
brokenFragments.push_back (broken);
|
||||
|
||||
intervalFragments = brokenFragments;
|
||||
}
|
||||
|
||||
// Return all the fragments as intervals.
|
||||
for (auto& fragment : intervalFragments)
|
||||
{
|
||||
// Clone the interval, set the new range.
|
||||
Interval clipped {interval};
|
||||
clipped.range = fragment;
|
||||
all.push_back (clipped);
|
||||
}
|
||||
for (auto& fragment : splitInterval (interval, exclusions))
|
||||
all.push_back (fragment);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue