TW #1973: Don't nag when no tasks are READY

- Thanks to Martin F. Krafft
This commit is contained in:
Paul Beckingham 2018-03-18 11:09:34 -04:00
parent 06521a1b55
commit 24a68b2ad8
4 changed files with 36 additions and 15 deletions

View file

@ -326,3 +326,4 @@ suggestions:
Marc Richter
rjc
php-coder
Martin F. Krafft

View file

@ -69,7 +69,7 @@
Thanks to rjc
- TW-1910 unreachable statement
Thanks to Martin Strunz
= TW-1917/#1930 "above" does a string comparison, even when the value is numeric
- TW-1917/#1930 "above" does a string comparison, even when the value is numeric
Thanks to Dirk Deimeke
- TW-1930 Typo in help
Thanks to Kai HTML
@ -81,14 +81,16 @@
Thanks to Paul J. Fenwick
- TW-1947 "urgency.over" filter seems to not work correct
Thanks to Marc Richter
- #1964 task burndown shows extra brackets #1964
Thanks to php-coder
- #1966 Tests: Don't hardcode errno constants #1966
Thanks to Jakub Wilk
- #2 Update to markdown and rename DEVELOPER to DEVELOPER.md
Thanks to Lynoure Braakman
- #1 URL formating
Thanks to buhtz
- TW #1964 task burndown shows extra brackets #1964
Thanks to php-coder
- TW #1966 Tests: Don't hardcode errno constants #1966
Thanks to Jakub Wilk
- TW #2 Update to markdown and rename DEVELOPER to DEVELOPER.md
Thanks to Lynoure Braakman
- TW #1 URL formating
Thanks to buhtz
- TW #1973 Don't nag when no tasks are READY
Thanks to Martin F. Krafft
- Added 'juhannus' as a synonym for 'midsommarafton'
Thanks to Lynoure Braakman
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'

View file

@ -47,8 +47,9 @@ bool nag (Task& task)
auto pending = Context::getContext ().tdb2.pending.get_tasks ();
for (auto& t : pending)
{
if ((t.getStatus () == Task::pending ||
if ((t.getStatus () == Task::pending ||
t.getStatus () == Task::waiting) &&
t.hasTag ("READY") &&
t.urgency () > task.urgency ())
{
Context::getContext ().footnote (msg);

View file

@ -36,11 +36,13 @@ from basetest import Task, TestCase
class TestNagging(TestCase):
@classmethod
def setUpClass(cls):
"""Executed once before any test in the class"""
cls.t = Task()
cls.t.config("nag", "NAG")
def setUp(self):
"""Executed before each test in the class"""
# Used to initialize objects that should be re-initialized or
# re-created for each individual test
self.t = Task()
self.t.config("nag", "NAG")
def test_nagging(self):
"""Verify that nagging works when tasks are done in the 'wrong' order"""
@ -73,6 +75,21 @@ class TestNagging(TestCase):
code, out, err = self.t("1 done")
self.assertNotIn("NAG", err)
def test_nagging_ready(self):
"""Verify that nagging occurs when there are READY tasks of higher urgency"""
self.t("add one") # low urgency
self.t("add two due:10days scheduled:yesterday") # medium urgency, ready
code, out, err = self.t("1 done")
self.assertIn("NAG", err)
def test_nagging_not_ready(self):
"""Verify that nagging does not occur when there are unREADY tasks of higher urgency"""
self.t("add one") # low urgency
self.t("add two due:10days scheduled:10days") # medium urgency, not ready
code, out, err = self.t("1 done")
self.assertNotIn("NAG", err)
if __name__ == "__main__":
from simpletap import TAPTestRunner