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 Marc Richter
rjc rjc
php-coder php-coder
Martin F. Krafft

View file

@ -69,7 +69,7 @@
Thanks to rjc Thanks to rjc
- TW-1910 unreachable statement - TW-1910 unreachable statement
Thanks to Martin Strunz 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 Thanks to Dirk Deimeke
- TW-1930 Typo in help - TW-1930 Typo in help
Thanks to Kai HTML Thanks to Kai HTML
@ -81,14 +81,16 @@
Thanks to Paul J. Fenwick Thanks to Paul J. Fenwick
- TW-1947 "urgency.over" filter seems to not work correct - TW-1947 "urgency.over" filter seems to not work correct
Thanks to Marc Richter Thanks to Marc Richter
- #1964 task burndown shows extra brackets #1964 - TW #1964 task burndown shows extra brackets #1964
Thanks to php-coder Thanks to php-coder
- #1966 Tests: Don't hardcode errno constants #1966 - TW #1966 Tests: Don't hardcode errno constants #1966
Thanks to Jakub Wilk Thanks to Jakub Wilk
- #2 Update to markdown and rename DEVELOPER to DEVELOPER.md - TW #2 Update to markdown and rename DEVELOPER to DEVELOPER.md
Thanks to Lynoure Braakman Thanks to Lynoure Braakman
- #1 URL formating - TW #1 URL formating
Thanks to buhtz 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' - Added 'juhannus' as a synonym for 'midsommarafton'
Thanks to Lynoure Braakman Thanks to Lynoure Braakman
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY' - Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'

View file

@ -49,6 +49,7 @@ bool nag (Task& task)
{ {
if ((t.getStatus () == Task::pending || if ((t.getStatus () == Task::pending ||
t.getStatus () == Task::waiting) && t.getStatus () == Task::waiting) &&
t.hasTag ("READY") &&
t.urgency () > task.urgency ()) t.urgency () > task.urgency ())
{ {
Context::getContext ().footnote (msg); Context::getContext ().footnote (msg);

View file

@ -36,11 +36,13 @@ from basetest import Task, TestCase
class TestNagging(TestCase): class TestNagging(TestCase):
@classmethod
def setUpClass(cls): def setUp(self):
"""Executed once before any test in the class""" """Executed before each test in the class"""
cls.t = Task() # Used to initialize objects that should be re-initialized or
cls.t.config("nag", "NAG") # re-created for each individual test
self.t = Task()
self.t.config("nag", "NAG")
def test_nagging(self): def test_nagging(self):
"""Verify that nagging works when tasks are done in the 'wrong' order""" """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") code, out, err = self.t("1 done")
self.assertNotIn("NAG", err) 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__": if __name__ == "__main__":
from simpletap import TAPTestRunner from simpletap import TAPTestRunner