mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
CmdShorten: Added error when attempting to shorten an open interval
This commit is contained in:
parent
ad400e0c47
commit
0b5253987f
1 changed files with 10 additions and 6 deletions
|
@ -64,14 +64,18 @@ int CmdShorten (
|
|||
{
|
||||
// Note: It's okay to subtract a one-based number from a zero-based index.
|
||||
Interval i = tracked[tracked.size () - id];
|
||||
if (! i.range.is_open ())
|
||||
{
|
||||
Duration dur (delta);
|
||||
i.range.end -= dur.toTime_t ();
|
||||
|
||||
Duration dur (delta);
|
||||
i.range.end -= dur.toTime_t ();
|
||||
database.modifyInterval (tracked[tracked.size () - id], i);
|
||||
|
||||
database.modifyInterval (tracked[tracked.size () - id], i);
|
||||
|
||||
// Feedback.
|
||||
std::cout << "Shortened @" << id << " by " << dur.formatHours () << '\n';
|
||||
// Feedback.
|
||||
std::cout << "Shortened @" << id << " by " << dur.formatHours () << '\n';
|
||||
}
|
||||
else
|
||||
std::cout << "Cannot shorten open interval @" << id << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue