mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdStart: Refactored data I/O
This commit is contained in:
parent
762dda43ca
commit
b6e5ded895
1 changed files with 5 additions and 4 deletions
|
@ -37,21 +37,22 @@ int CmdStart (
|
|||
Database& database)
|
||||
{
|
||||
// Load the most recent interval.
|
||||
auto latest = database.getLatestInterval ();
|
||||
auto latest = getLatestInterval (database);
|
||||
|
||||
// If the latest interval is open, close it.
|
||||
if ( latest.isStarted () &&
|
||||
! latest.isEnded ())
|
||||
{
|
||||
// Stop it.
|
||||
latest.end (Datetime ());
|
||||
auto modified {latest};
|
||||
modified.end (Datetime ());
|
||||
|
||||
// Update database.
|
||||
database.modifyInterval (latest);
|
||||
database.modifyInterval (latest, modified);
|
||||
|
||||
// User feedback.
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (rules, latest);
|
||||
std::cout << intervalSummarize (rules, modified);
|
||||
}
|
||||
|
||||
// Create a new interval.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue