mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
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:
parent
711848915b
commit
35a38d628c
4 changed files with 36 additions and 31 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue