Trigger TODOs that are in the past if they haven't yet been completed.

This commit is contained in:
Dianne Skoll
2025-08-11 17:09:45 -04:00
parent 9199ed5cf7
commit d9ab9e91b5
2 changed files with 14 additions and 4 deletions

View File

@@ -38,7 +38,7 @@ get_scanfrom(Trigger *t)
if (t->scanfrom != NO_DATE) {
if (t->complete_through != NO_DATE) {
if (t->complete_through+1 > t->scanfrom) {
return t->complete_through + 1;
return t->complete_through+1;
} else {
return t->scanfrom;
}
@@ -49,6 +49,10 @@ get_scanfrom(Trigger *t)
if (t->complete_through != NO_DATE) {
return t->complete_through+1;
}
if (t->is_todo) {
/* TODO with no COMPLETE-THROUGH. Scan from the beginning of time */
return 0;
}
return DSEToday;
}
@@ -1507,7 +1511,13 @@ int ShouldTriggerReminder(Trigger const *t, TimeTrig const *tim, int dse, int *e
if (!IgnoreOnce && t->once !=NO_ONCE && GetOnceDate() == DSEToday)
return 0;
if (dse < DSEToday) return 0;
if (t->is_todo) {
if (t->complete_through != NO_DATE && t->complete_through >= DSEToday) {
return 0;
}
} else {
if (dse < DSEToday) return 0;
}
/* Don't trigger timed reminders if DontIssueAts is true, and if the
reminder is for today */

View File

@@ -358,7 +358,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
}
}
if (diff <= 1) {
if (abs(diff) <= 1) {
switch(UPPER(c)) {
case 'A':
case 'B':
@@ -373,7 +373,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig const *tt, int
case 'L':
case 'U':
case 'V':
snprintf(s, sizeof(s), "%s", (diff ? tr("tomorrow") : tr("today")));
snprintf(s, sizeof(s), "%s", (diff == 1 ? tr("tomorrow") : diff == -1 ? tr("yesterday") : tr("today")));
SHIP_OUT(s);
done = 1;
break;