mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Feature #457
- Tasks may now be given an 'until' date, after which they expire and are deleted.
This commit is contained in:
parent
d122173103
commit
665bc197dc
11 changed files with 40 additions and 18 deletions
|
@ -56,6 +56,7 @@ extern Context context;
|
|||
void handleRecurrence ()
|
||||
{
|
||||
std::vector <Task> tasks = context.tdb2.pending.get_tasks ();
|
||||
Date now;
|
||||
|
||||
// Look at all tasks and find any recurring ones.
|
||||
std::vector <Task>::iterator t;
|
||||
|
@ -68,12 +69,10 @@ void handleRecurrence ()
|
|||
std::vector <Date> due;
|
||||
if (!generateDueDates (*t, due))
|
||||
{
|
||||
std::cout << format (STRING_RECUR_PAST_UNTIL, trim (t->get ("description")))
|
||||
<< "\n";
|
||||
|
||||
// Determine the end date.
|
||||
t->setStatus (Task::deleted);
|
||||
context.tdb2.modify (*t);
|
||||
context.footnote (onExpiration (*t));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -137,6 +136,18 @@ void handleRecurrence ()
|
|||
context.tdb2.modify (*t);
|
||||
}
|
||||
}
|
||||
|
||||
// Non-recurring tasks expire too.
|
||||
else
|
||||
{
|
||||
if (t->has ("until") &&
|
||||
Date (t->get_date ("until")) < now)
|
||||
{
|
||||
t->setStatus (Task::deleted);
|
||||
context.tdb2.modify(*t);
|
||||
context.footnote (onExpiration (*t));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue