Optimize handling of implicit latest interval

- If no id is given but active time tracking (i.e. open interval) is present
  then apply the command to the open interval
This commit is contained in:
Thomas Lauf 2020-01-26 17:16:01 +01:00
parent 711848915b
commit 35a38d628c
4 changed files with 36 additions and 31 deletions

View file

@ -675,7 +675,7 @@ std::vector <Interval> getTracked (
{
auto begin = database.rbegin ();
auto end = database.rend ();
if (begin != end)
if (begin != end)
{
filter.start = IntervalFactory::fromSerialization (*begin).start;
}
@ -703,7 +703,7 @@ std::vector <Interval> getTracked (
else if (interval.start.toEpoch () >= filter.start.toEpoch ())
{
++id_skip;
}
}
else
{
break;
@ -788,6 +788,7 @@ Interval getLatestInterval (Database& database)
if (! latestEntry.empty ())
{
i = IntervalFactory::fromSerialization (latestEntry);
i.id = 1;
}
return i;