Commit fd7bf73b authored by Bram Schoenmakers's avatar Bram Schoenmakers

With normal recurrence, always use today as the offset.

parent f358c227
......@@ -21,14 +21,14 @@ from Config import config
from Recurrence import advance_recurring_todo, strict_advance_recurring_todo, NoRecurrenceException
import Todo
class RelativeDateTester(unittest.TestCase):
class RecurrenceTest(unittest.TestCase):
def setUp(self):
self.todo = Todo.Todo("Test rec:1w")
def test_duedate1(self):
""" Where due date is in the future. """
future = date.today() + timedelta(1)
new_due = date.today() + timedelta(8)
new_due = date.today() + timedelta(7)
self.todo.set_tag(config().tag_due(), future.isoformat())
new_todo = advance_recurring_todo(self.todo)
......
......@@ -25,15 +25,6 @@ import Todo
class NoRecurrenceException(Exception):
pass
def _get_due_date(p_todo):
"""
Gets the due date of a todo as a date object. Defaults to today when the
todo has no due date, or when the due date was in the past.
"""
due = p_todo.due_date()
return due if (due and due >= date.today()) else date.today()
def _advance_recurring_todo_helper(p_todo, p_offset):
"""
Given a Todo item, return a new instance of a Todo item with the dates
......@@ -62,7 +53,7 @@ def _advance_recurring_todo_helper(p_todo, p_offset):
return todo
def advance_recurring_todo(p_todo):
return _advance_recurring_todo_helper(p_todo, _get_due_date(p_todo))
return _advance_recurring_todo_helper(p_todo, date.today())
def strict_advance_recurring_todo(p_todo):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment