TI-102: Add interval flattening to CmdStop

This commit is contained in:
Thomas Lauf 2018-01-19 15:26:03 +01:00
parent f617588f57
commit f6e892d118

View file

@ -24,12 +24,9 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <format.h>
#include <commands.h>
#include <timew.h>
#include <Interval.h>
#include <Lexer.h>
#include <iostream>
template <class T> T setIntersect (
@ -69,12 +66,21 @@ int CmdStop (
modified.range.end = filter.range.start;
}
else
{
modified.range.end = Datetime ();
}
// Close the interval.
database.deleteInterval (latest);
validate (cli, rules, database, modified);
database.addInterval (modified);
for (auto& interval : flatten (modified, getAllExclusions (rules, modified.range)))
{
database.addInterval (interval);
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (database, rules, interval);
}
// If tags are specified, but are not a full set of tags, remove them
// before closing the interval.