mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
data: Fixed bug in subtractRanges
This commit is contained in:
parent
7638499f44
commit
33827a2da0
1 changed files with 9 additions and 7 deletions
16
src/data.cpp
16
src/data.cpp
|
@ -482,14 +482,16 @@ std::vector <Range> subtractRanges (
|
|||
const std::vector <Range>& ranges,
|
||||
const std::vector <Range>& subtractions)
|
||||
{
|
||||
if (! subtractions.size ())
|
||||
return ranges;
|
||||
std::vector <Range> results = ranges;
|
||||
for (auto& s : subtractions)
|
||||
{
|
||||
std::vector <Range> split_results;
|
||||
for (auto& range : results)
|
||||
for (auto& split_range : range.subtract (s))
|
||||
split_results.push_back (split_range);
|
||||
|
||||
std::vector <Range> results;
|
||||
for (auto& r1 : ranges)
|
||||
for (auto& r2 : subtractions)
|
||||
for (auto& r3 : r1.subtract (r2))
|
||||
results.push_back (limits.intersect (r3));
|
||||
results = split_results;
|
||||
}
|
||||
|
||||
/*
|
||||
std::cout << "# subtractRange:\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue