mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TI-6: Exception after shortening task.
- Thanks to Sergey Trofimov.
This commit is contained in:
parent
ec84fd447c
commit
da9b2a7fdb
3 changed files with 32 additions and 4 deletions
|
@ -67,12 +67,23 @@ int CmdShorten (
|
|||
if (! i.range.is_open ())
|
||||
{
|
||||
Duration dur (delta);
|
||||
i.range.end -= dur.toTime_t ();
|
||||
if (dur < (i.range.end - i.range.start))
|
||||
{
|
||||
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 interval @"
|
||||
<< id
|
||||
<< " by "
|
||||
<< dur.formatHours ()
|
||||
<< " because it is only "
|
||||
<< Duration (i.range.end - i.range.start).formatHours ()
|
||||
<< " in length.\n";
|
||||
}
|
||||
else
|
||||
std::cout << "Cannot shorten open interval @" << id << '\n';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue