mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
data: flatten only returns historical data
This commit is contained in:
parent
06123411d7
commit
2e314b5809
1 changed files with 13 additions and 1 deletions
12
src/data.cpp
12
src/data.cpp
|
@ -29,6 +29,7 @@
|
|||
#include <Datetime.h>
|
||||
#include <Duration.h>
|
||||
#include <timew.h>
|
||||
#include <iostream>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A filter is just another interval, containing start, end and tags.
|
||||
|
@ -385,12 +386,23 @@ std::vector <Interval> flatten (
|
|||
if (interval.range.encloses (e))
|
||||
enclosed.push_back (e);
|
||||
|
||||
Datetime now;
|
||||
for (auto& result : subtractRanges ({interval.range}, enclosed))
|
||||
{
|
||||
Interval chunk {interval};
|
||||
chunk.range = result;
|
||||
|
||||
// Only historical data is included.
|
||||
if (chunk.range.start <= now)
|
||||
{
|
||||
// A future range.end should be truncated.
|
||||
if (! chunk.range.is_open () &&
|
||||
chunk.range.end >= now)
|
||||
chunk.range.end = now;
|
||||
|
||||
all.push_back (chunk);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
std::cout << "# results:\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue