mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdContinue: Handles case where there is no previous interval to restart
This commit is contained in:
parent
100d567b79
commit
eb06efc92a
1 changed files with 17 additions and 11 deletions
|
@ -35,23 +35,29 @@ int CmdContinue (
|
|||
Database& database)
|
||||
{
|
||||
auto latest = getLatestInterval (database);
|
||||
|
||||
if (latest.isStarted () &&
|
||||
latest.isEnded ())
|
||||
if (! latest.empty ())
|
||||
{
|
||||
// Open an identical interval.
|
||||
latest.start ({});
|
||||
latest.end ({0});
|
||||
if (latest.isStarted () &&
|
||||
latest.isEnded ())
|
||||
{
|
||||
// Open an identical interval.
|
||||
latest.start ({});
|
||||
latest.end ({0});
|
||||
|
||||
// Update database.
|
||||
database.addInterval (latest);
|
||||
// Update database.
|
||||
database.addInterval (latest);
|
||||
|
||||
// User feedback.
|
||||
std::cout << intervalSummarize (rules, latest);
|
||||
// User feedback.
|
||||
std::cout << intervalSummarize (rules, latest);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "There is already active tracking.\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "There is already active tracking.\n";
|
||||
std::cout << "There is no previous tracking to continue.\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue