From 1abf6e9320d20aa593edd0e7e106e546ae022d7a Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Sat, 18 Jan 2020 16:30:22 -0600 Subject: [PATCH] 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 --- src/Database.cpp | 2 +- src/Database.h | 2 +- src/data.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Database.cpp b/src/Database.cpp index 605c41ac..e9651fea 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -268,7 +268,7 @@ std::set Database::tags () const //////////////////////////////////////////////////////////////////////////////// // Return most recent line from database -std::string Database::firstLine () +std::string Database::getLatestEntry () { for (auto& line : *this) { diff --git a/src/Database.h b/src/Database.h index 50716aaa..97a8d413 100644 --- a/src/Database.h +++ b/src/Database.h @@ -99,7 +99,7 @@ public: std::vector files () const; std::set tags () const; - std::string firstLine (); + std::string getLatestEntry (); void addInterval (const Interval&, bool verbose); void deleteInterval (const Interval&); diff --git a/src/data.cpp b/src/data.cpp index 52c35f42..bbf94654 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -784,10 +784,10 @@ std::vector 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;