TW-1714: Starting recurring task starts all recurrences

- Thanks to Robin Green.
This commit is contained in:
Paul Beckingham 2016-01-11 23:20:33 -05:00
parent d564aac978
commit 7f3db8f201
6 changed files with 17 additions and 8 deletions

View file

@ -282,3 +282,5 @@ suggestions:
James Dietrich
JDufault
Simon Michael
Robin Green

View file

@ -24,6 +24,7 @@
- TW-1704 Use Task::identifier to reference the Task in the output
- TW-1705 Directories in .task/hooks should not be reported as invalid hooks
(thanks to Tomas Babej).
- TW-1714 Starting recurring task starts all recurrences (thanks to Robin Green).
- TW-1720 CmdContext uses a mix of both throw and std::cout to convey
errors (thanks to Paul Beckingham).
- TW-1723 task info causes segfault (thanks to Roman Golovin).

View file

@ -59,9 +59,14 @@ int CmdAdd::execute (std::string& output)
context.tdb2.add (task);
// Do not display ID 0, users cannot query by that
if (context.verbose ("new-id") && task.id != 0)
auto status = task.getStatus ();
if (context.verbose ("new-id") &&
(status == Task::pending ||
status == Task::waiting))
output += format (STRING_CMD_ADD_FEEDBACK, task.id) + "\n";
else if (context.verbose ("new-uuid"))
else if (context.verbose ("new-uuid") &&
status != Task::recurring)
output += format (STRING_CMD_ADD_FEEDBACK, task.get ("uuid")) + "\n";
if (context.verbose ("project"))

View file

@ -114,9 +114,14 @@ int CmdDuplicate::execute (std::string&)
++count;
feedback_affected (STRING_CMD_DUPLICATE_TASK, task);
if (context.verbose ("new-id"))
auto status = dup.getStatus ();
if (context.verbose ("new-id") &&
(status == Task::pending ||
status == Task::waiting))
std::cout << format (STRING_CMD_ADD_FEEDBACK, dup.id) + "\n";
else if (context.verbose ("new-uuid"))
else if (context.verbose ("new-uuid") &&
status != Task::recurring)
std::cout << format (STRING_CMD_ADD_FEEDBACK, dup.get ("uuid")) + "\n";
if (context.verbose ("project"))

View file

@ -85,7 +85,6 @@ class TestBug1438(TestCase):
def test_recurring_tasks_shouldn_ask_for_confirmation(self):
"""1438: rc.confirmation=off still prompts while changing recurring tasks"""
code, out, err = self.t("add Sometimes due:tomorrow recur:daily")
self.assertIn("Created task 1", out)
code, out, err = self.t("list")
self.assertIn("Sometimes", out)

View file

@ -498,10 +498,7 @@ class TestBugC001(TestCase):
def test_id_increment(self):
"""C001: Verify that entering two consecutive recurring tasks increments reported ID"""
code, out, err = self.t("add one due:tomorrow recur:daily")
self.assertIn("Created task 1.", out)
code, out, err = self.t("add two due:tomorrow recur:daily")
self.assertIn("Created task 2.", out)
class TestBug839(TestCase):
def setUp(self):