mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TI-102: Improve interval flattening for CmdTrack
- Report on added intervals, not on entered interval
This commit is contained in:
parent
7e9fe82fc3
commit
f617588f57
1 changed files with 7 additions and 6 deletions
|
@ -24,7 +24,6 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <commands.h>
|
||||
#include <timew.h>
|
||||
#include <iostream>
|
||||
|
@ -35,9 +34,10 @@ int CmdTrack (
|
|||
Rules& rules,
|
||||
Database& database)
|
||||
{
|
||||
auto filter = getFilter (cli);
|
||||
|
||||
// If this is not a proper closed interval, then the user is trying to make
|
||||
// the 'track' command behave like 'start', so delegate to CmdStart.
|
||||
auto filter = getFilter (cli);
|
||||
if (! filter.range.is_started () ||
|
||||
! filter.range.is_ended ())
|
||||
return CmdStart (cli, rules, database);
|
||||
|
@ -45,12 +45,13 @@ int CmdTrack (
|
|||
// Validation must occur before flattening.
|
||||
validate (cli, rules, database, filter);
|
||||
|
||||
auto exclusions = getAllExclusions (rules, filter.range);
|
||||
for (auto& interval : flatten (filter, exclusions))
|
||||
for (auto& interval : flatten (filter, getAllExclusions (rules, filter.range)))
|
||||
{
|
||||
database.addInterval (interval);
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (database, rules, filter);
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << intervalSummarize (database, rules, interval);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue