mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Datafile: Implemented ::getIntervalsSince
This commit is contained in:
parent
35ea8b19f5
commit
3e16f52621
1 changed files with 13 additions and 2 deletions
|
@ -65,9 +65,20 @@ Interval Datafile::getLatestInterval ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::vector <Interval> Datafile::getAllIntervalsSince (Datetime)
|
std::vector <Interval> Datafile::getAllIntervalsSince (Datetime when)
|
||||||
{
|
{
|
||||||
// TODO Load data
|
if (when >= _day1 && when <= _dayN)
|
||||||
|
{
|
||||||
|
if (! _intervals_loaded)
|
||||||
|
load_intervals ();
|
||||||
|
|
||||||
|
// Rely on intervals being sorted by start time.
|
||||||
|
std::vector <Interval>::iterator i;
|
||||||
|
for (i = _intervals.begin (); i != _intervals.end (); i++)
|
||||||
|
if (i->start () >= when)
|
||||||
|
return std::vector <Interval> (i, _intervals.end ());
|
||||||
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue