mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 19:17:19 +02:00
Recurrence: Broke out handleUntil as a separate function
- This means until porocesing is no longer controlled by rc.recurrence, which was never intended.
This commit is contained in:
parent
e991004c43
commit
97b038ce29
14 changed files with 40 additions and 12 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <cmake.h>
|
||||
#include <Datetime.h>
|
||||
#include <Context.h>
|
||||
#include <main.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
|
@ -82,3 +83,22 @@ void handleRecurrence2 ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Delete expired tasks.
|
||||
void handleUntil ()
|
||||
{
|
||||
Datetime now;
|
||||
auto tasks = context.tdb2.pending.get_tasks ();
|
||||
for (auto& t : tasks)
|
||||
{
|
||||
if (t.getStatus () == Task::pending &&
|
||||
t.has ("until") &&
|
||||
Datetime (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