CmdStart: Do not silently fail if tags match

It was possible previously to start an interval with a filter earlier
than the current filter, and if the tags matched, the command would
report success without actually moving the start time.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
Shaun Ruffell 2020-06-07 23:12:58 -05:00 committed by Thomas Lauf
parent 356f20c9de
commit 6a52a412ba
2 changed files with 11 additions and 1 deletions

View file

@ -48,12 +48,17 @@ int CmdStart (
journal.startTransaction ();
if (!filter.is_started ())
{
filter.start = now;
}
// If the latest interval is open, close it.
if (latest.is_open ())
{
// If the new interval tags match those of the currently open interval, then
// do nothing - the tags are already being tracked.
if (latest.tags () == filter.tags ())
if (latest.encloses (filter) && latest.tags () == filter.tags ())
{
if (verbose)
std::cout << intervalSummarize (database, rules, latest);