mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdStop: Refactored data I/O
This commit is contained in:
parent
b6e5ded895
commit
6965b506e8
1 changed files with 5 additions and 4 deletions
|
@ -38,19 +38,20 @@ int CmdStop (
|
|||
Database& database)
|
||||
{
|
||||
// Load the most recent interval.
|
||||
auto latest = database.getLatestInterval ();
|
||||
auto latest = getLatestInterval (database);
|
||||
|
||||
// Verify the interval is open.
|
||||
if ( latest.isStarted () &&
|
||||
! latest.isEnded ())
|
||||
{
|
||||
// Stop it.
|
||||
latest.end (Datetime ());
|
||||
database.modifyInterval (latest);
|
||||
auto modified {latest};
|
||||
modified.end (Datetime ());
|
||||
database.modifyInterval (latest, modified);
|
||||
|
||||
// User feedback.
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (rules, latest);
|
||||
std::cout << intervalSummarize (rules, modified);
|
||||
|
||||
// If tags were specified, and after removing those tags, there are still
|
||||
// tags remaining, then add a contiguous interval.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue