Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
fd7bf73b
Commit
fd7bf73b
authored
Nov 10, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
With normal recurrence, always use today as the offset.
parent
f358c227
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
test/RecurrenceTest.py
test/RecurrenceTest.py
+2
-2
topydo/lib/Recurrence.py
topydo/lib/Recurrence.py
+2
-11
No files found.
test/RecurrenceTest.py
View file @
fd7bf73b
...
...
@@ -21,14 +21,14 @@ from Config import config
from
Recurrence
import
advance_recurring_todo
,
strict_advance_recurring_todo
,
NoRecurrenceException
import
Todo
class
Re
lativeDateTester
(
unittest
.
TestCase
):
class
Re
currenceTest
(
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
)
...
...
topydo/lib/Recurrence.py
View file @
fd7bf73b
...
...
@@ -23,16 +23,7 @@ from RelativeDate import relative_date_to_date
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
()
pass
def
_advance_recurring_todo_helper
(
p_todo
,
p_offset
):
"""
...
...
@@ -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
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment