Database: firstLine -> getLatestEntry

firstLine is ambiguous (the first line that was added in time? The first line
that will be returned when iterating the database?)

See https://github.com/GothenburgBitFactory/timewarrior/pull/269#discussion_r367922757
This commit is contained in:
Shaun Ruffell 2020-01-18 16:30:22 -06:00 committed by lauft
parent c7c1ea632a
commit 1abf6e9320
3 changed files with 5 additions and 5 deletions

View file

@ -268,7 +268,7 @@ std::set <std::string> Database::tags () const
////////////////////////////////////////////////////////////////////////////////
// Return most recent line from database
std::string Database::firstLine ()
std::string Database::getLatestEntry ()
{
for (auto& line : *this)
{

View file

@ -99,7 +99,7 @@ public:
std::vector <std::string> files () const;
std::set <std::string> tags () const;
std::string firstLine ();
std::string getLatestEntry ();
void addInterval (const Interval&, bool verbose);
void deleteInterval (const Interval&);

View file

@ -784,10 +784,10 @@ std::vector <Range> getUntracked (
Interval getLatestInterval (Database& database)
{
Interval i;
auto firstLine = database.firstLine ();
if (! firstLine.empty ())
auto latestEntry = database.getLatestEntry ();
if (! latestEntry.empty ())
{
i = IntervalFactory::fromSerialization (firstLine);
i = IntervalFactory::fromSerialization (latestEntry);
}
return i;