mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
helper: Refactored data I/O
This commit is contained in:
parent
91f6600909
commit
77131546ee
2 changed files with 13 additions and 6 deletions
|
@ -176,20 +176,27 @@ Timeline createTimelineFromData (
|
|||
// TODO Add filtered exclusions.
|
||||
|
||||
// Add filtered intervals.
|
||||
for (auto& interval : database.getAllIntervals ())
|
||||
for (auto& line : database.allLines ())
|
||||
{
|
||||
Interval interval;
|
||||
interval.initialize (line);
|
||||
|
||||
if (intervalMatchesFilter (interval, filter))
|
||||
t.include (interval);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Interval getLatestInterval (
|
||||
Timeline& timeline,
|
||||
Database& database,
|
||||
const Filter& filter)
|
||||
Interval getLatestInterval (Database& database)
|
||||
{
|
||||
Interval i;
|
||||
auto lastLine = database.lastLine ();
|
||||
if (lastLine != "")
|
||||
i.initialize (lastLine);
|
||||
|
||||
// TODO Mask i against timeline.
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ std::string intervalSummarize (const Rules&, const Interval&);
|
|||
void expandIntervalHint (const std::string&, std::string&, std::string&);
|
||||
Filter createFilterFromCLI (const CLI&);
|
||||
Timeline createTimelineFromData (const Rules&, Database&, const Filter&);
|
||||
Interval getLatestInterval (Timeline&, Database&, const Filter&);
|
||||
Interval getLatestInterval (Database&);
|
||||
bool intervalMatchesFilter (const Interval&, const Filter&);
|
||||
std::string jsonFromIntervals (const std::vector <Interval>&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue