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.
|
// TODO Add filtered exclusions.
|
||||||
|
|
||||||
// Add filtered intervals.
|
// Add filtered intervals.
|
||||||
for (auto& interval : database.getAllIntervals ())
|
for (auto& line : database.allLines ())
|
||||||
|
{
|
||||||
|
Interval interval;
|
||||||
|
interval.initialize (line);
|
||||||
|
|
||||||
if (intervalMatchesFilter (interval, filter))
|
if (intervalMatchesFilter (interval, filter))
|
||||||
t.include (interval);
|
t.include (interval);
|
||||||
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Interval getLatestInterval (
|
Interval getLatestInterval (Database& database)
|
||||||
Timeline& timeline,
|
|
||||||
Database& database,
|
|
||||||
const Filter& filter)
|
|
||||||
{
|
{
|
||||||
Interval i;
|
Interval i;
|
||||||
|
auto lastLine = database.lastLine ();
|
||||||
|
if (lastLine != "")
|
||||||
|
i.initialize (lastLine);
|
||||||
|
|
||||||
|
// TODO Mask i against timeline.
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ std::string intervalSummarize (const Rules&, const Interval&);
|
||||||
void expandIntervalHint (const std::string&, std::string&, std::string&);
|
void expandIntervalHint (const std::string&, std::string&, std::string&);
|
||||||
Filter createFilterFromCLI (const CLI&);
|
Filter createFilterFromCLI (const CLI&);
|
||||||
Timeline createTimelineFromData (const Rules&, Database&, const Filter&);
|
Timeline createTimelineFromData (const Rules&, Database&, const Filter&);
|
||||||
Interval getLatestInterval (Timeline&, Database&, const Filter&);
|
Interval getLatestInterval (Database&);
|
||||||
bool intervalMatchesFilter (const Interval&, const Filter&);
|
bool intervalMatchesFilter (const Interval&, const Filter&);
|
||||||
std::string jsonFromIntervals (const std::vector <Interval>&);
|
std::string jsonFromIntervals (const std::vector <Interval>&);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue