Skip to content

Commit

Permalink
Respect auto_creation_date when advancing recurring tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
niconfus authored and davesteele committed Feb 7, 2021
1 parent f327250 commit 7206d6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/data/docommand.conf
@@ -0,0 +1,2 @@
[add]
auto_creation_date = 0
11 changes: 11 additions & 0 deletions test/test_do_command.py
Expand Up @@ -18,6 +18,7 @@
from datetime import date, timedelta

from topydo.commands.DoCommand import DoCommand
from topydo.lib.Config import config
from topydo.lib.TodoList import TodoList

from .command_testcase import CommandTest
Expand Down Expand Up @@ -169,6 +170,16 @@ def test_strict_recurrence2(self):
| 12| {today} Strict due:2014-01-02 rec:1d\n""".format(today=self.today)
self.assertEqual(self.output, result)

def test_recurrence_no_creation_date(self):
config("test/data/docommand.conf")

self._recurrence_helper(["4"])

result = """Completed: x {today} Recurring! rec:1d
The following todo item(s) became active:
| 12| Recurring! rec:1d due:{tomorrow}\n""".format(today=self.today, tomorrow=self.tomorrow)
self.assertEqual(self.output, result)

def test_invalid1(self):
command = DoCommand(["99"], self.todolist, self.out, self.error)
command.execute()
Expand Down
3 changes: 2 additions & 1 deletion topydo/lib/Recurrence.py
Expand Up @@ -68,6 +68,7 @@ def advance_recurring_todo(p_todo, p_offset=None, p_strict=False):
new_start = new_due - timedelta(length)
todo.set_tag(config().tag_start(), new_start.isoformat())

todo.set_creation_date(date.today())
if config().auto_creation_date():
todo.set_creation_date(date.today())

return todo

0 comments on commit 7206d6c

Please sign in to comment.