diff --git a/AUTHORS b/AUTHORS index d1ff904d0..029d919aa 100644 --- a/AUTHORS +++ b/AUTHORS @@ -235,4 +235,5 @@ suggestions: Black Ops Testing Jens Erat Leon Feng + Tomas Babej diff --git a/ChangeLog b/ChangeLog index 95e9d6930..f15e415ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -183,6 +183,7 @@ confirmation requests (thanks to Adam Coddington). - TW-1441 task import continues happily if filename doesn't exist. - TW-1444 Tag ordering is preserved, but should be sorted in reports. +- TW-1449 Nag function does not respect urgency (thanks to Tomas Babej). - TW-1460 Empty due dates lead to endless loop. - TW-1463 A few more problems with special characters in filters, pluses, question marks, and braces (thanks to Ralph Bean). diff --git a/src/recur.cpp b/src/recur.cpp index bc3dd520d..1a61018fa 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -406,6 +406,9 @@ void updateRecurrenceMask (Task& task) // Returns a Boolean indicator as to whether a nag message was generated, so // that commands can control the number of nag messages displayed (ie one is // enough). +// +// Otherwise generates a nag message, if one is defined, if there are tasks of +// higher urgency. bool nag (Task& task) { // Special tag overrides nagging. @@ -418,56 +421,16 @@ bool nag (Task& task) // Load all pending tasks. std::vector tasks = context.tdb2.pending.get_tasks (); - // Counters. - int overdue = 0; - int high = 0; - int medium = 0; - int low = 0; - bool isOverdue = false; - char pri = ' '; - // Scan all pending tasks. std::vector ::iterator t; for (t = tasks.begin (); t != tasks.end (); ++t) { - if (t->id == task.id) + if (t->urgency () > task.urgency ()) { - if (t->getDateState ("due") == Task::dateBeforeToday) - isOverdue = true; - - std::string priority = t->get ("priority"); - if (priority.length ()) - pri = priority[0]; - } - else if (t->getStatus () == Task::pending) - { - if (t->getDateState ("due") == Task::dateBeforeToday) - overdue++; - - std::string priority = t->get ("priority"); - if (priority.length ()) - { - switch (priority[0]) - { - case 'H': high++; break; - case 'M': medium++; break; - case 'L': low++; break; - } - } + context.footnote (nagMessage); + return true; } } - - // General form is "if there are no more deserving tasks", suppress the nag. - if (isOverdue ) return false; - if (pri == 'H' && !overdue ) return false; - if (pri == 'M' && !overdue && !high ) return false; - if (pri == 'L' && !overdue && !high && !medium ) return false; - if (pri == ' ' && !overdue && !high && !medium && !low ) return false; - if (task.is_blocking && !task.is_blocked ) return false; - - // All the excuses are made, all that remains is to nag the user. - context.footnote (nagMessage); - return true; } return false;