mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
TI-58: Fix bug 'Delete command is not always deleting'
- Update database before deleting sythetic intervals - Make Exclusion::ranges work with open interval
This commit is contained in:
parent
98218c4b75
commit
ad67539f94
4 changed files with 35 additions and 3 deletions
|
@ -50,12 +50,32 @@ int CmdDelete (
|
|||
Interval filter;
|
||||
auto tracked = getTracked (database, rules, filter);
|
||||
|
||||
// Apply tags to ids.
|
||||
bool dirty = true;
|
||||
|
||||
for (auto& id : ids)
|
||||
{
|
||||
if (id > static_cast <int> (tracked.size ()))
|
||||
throw format ("ID '@{1}' does not correspond to any tracking.", id);
|
||||
|
||||
if (tracked[tracked.size() - id].synthetic && dirty)
|
||||
{
|
||||
auto latest = getLatestInterval(database);
|
||||
auto exclusions = getAllExclusions (rules, filter.range);
|
||||
|
||||
Interval modified {latest};
|
||||
|
||||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
for (auto& interval : flatten (modified, exclusions))
|
||||
database.addInterval (interval);
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete intervals by id
|
||||
for (auto& id : ids)
|
||||
{
|
||||
database.deleteInterval (tracked[tracked.size () - id]);
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue