mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TI-7: Stop command shouldn't interrupt unrelated tags.
- Tanks to Sergey Trofimov.
This commit is contained in:
parent
cb812ebd25
commit
c869ec16ed
2 changed files with 19 additions and 17 deletions
|
@ -15,6 +15,8 @@
|
||||||
(thanks to Sergey Trofimov).
|
(thanks to Sergey Trofimov).
|
||||||
- TI-6 Exception after shortening task.
|
- TI-6 Exception after shortening task.
|
||||||
(thanks to Sergey Trofimov).
|
(thanks to Sergey Trofimov).
|
||||||
|
- TI-7 Stop command shouldn't interrupt unrelated tags.
|
||||||
|
(thanks to Sergey Trofimov).
|
||||||
- TI-8 Only the day's last interval is considered in the month report
|
- TI-8 Only the day's last interval is considered in the month report
|
||||||
(thanks to Tomas Babej).
|
(thanks to Tomas Babej).
|
||||||
- Added 'continue' command.
|
- Added 'continue' command.
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
|
#include <format.h>
|
||||||
#include <commands.h>
|
#include <commands.h>
|
||||||
#include <timew.h>
|
#include <timew.h>
|
||||||
#include <Interval.h>
|
#include <Interval.h>
|
||||||
|
@ -53,28 +54,27 @@ int CmdStop (
|
||||||
else
|
else
|
||||||
modified.range.end = Datetime ();
|
modified.range.end = Datetime ();
|
||||||
|
|
||||||
|
// Remove the filter tags.
|
||||||
|
for (auto& tag : filter.tags ())
|
||||||
|
if (modified.hasTag (tag))
|
||||||
|
modified.untag (tag);
|
||||||
|
else
|
||||||
|
throw format ("The current interval does not have the '{1}' tag.", tag);
|
||||||
|
|
||||||
|
// Close the interval.
|
||||||
database.modifyInterval (latest, modified);
|
database.modifyInterval (latest, modified);
|
||||||
|
latest.range.end = modified.range.end;
|
||||||
// TODO intervalSummarїze needs to operate on a vector of similar intervals.
|
|
||||||
if (rules.getBoolean ("verbose"))
|
if (rules.getBoolean ("verbose"))
|
||||||
std::cout << intervalSummarize (database, rules, modified);
|
std::cout << intervalSummarize (database, rules, latest);
|
||||||
|
|
||||||
// If tags were specified, and after removing those tags, there are still
|
// Open a new interval with remaining tags, if any.
|
||||||
// tags remaining, then add a contiguous interval.
|
if (filter.tags ().size () && modified.tags ().size ())
|
||||||
auto words = cli.getWords ();
|
|
||||||
if (words.size ())
|
|
||||||
for (auto& word : cli.getWords ())
|
|
||||||
latest.untag (Lexer::dequote (word));
|
|
||||||
|
|
||||||
if (words.size () &&
|
|
||||||
latest.tags ().size ())
|
|
||||||
{
|
{
|
||||||
// Contiguous with previous interval.
|
modified.range.start = modified.range.end;
|
||||||
latest.range.start = modified.range.end;
|
modified.range.end = {0};
|
||||||
latest.range.end = Datetime (0);
|
database.addInterval (modified);
|
||||||
database.addInterval (latest);
|
|
||||||
if (rules.getBoolean ("verbose"))
|
if (rules.getBoolean ("verbose"))
|
||||||
std::cout << '\n' << intervalSummarize (database, rules, latest);
|
std::cout << '\n' << intervalSummarize (database, rules, modified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue