From 05979025d214798a60674bfcca4807d690bebae4 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 22 Jul 2017 13:30:49 +0100 Subject: [PATCH] Recurrence: Updated 'until' handling --- src/recur2.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/recur2.cpp b/src/recur2.cpp index af420b818..ef4074bdc 100644 --- a/src/recur2.cpp +++ b/src/recur2.cpp @@ -355,13 +355,18 @@ void handleUntil () auto tasks = context.tdb2.pending.get_tasks (); for (auto& t : tasks) { + // TODO What about expiring template tasks? if (t.getStatus () == Task::pending && - t.has ("until") && - Datetime (t.get_date ("until")) < now) + t.has ("until")) { - t.setStatus (Task::deleted); - context.tdb2.modify(t); - context.footnote (onExpiration (t)); + auto until = Datetime (t.get_date ("until")); + if (until < now) + { + context.debug (format ("handleUntil: recurrence expired until {1} < now {2}", until.toISOLocalExtended (), now.toISOLocalExtended ())); + t.setStatus (Task::deleted); + context.tdb2.modify(t); + context.footnote (onExpiration (t)); + } } } }