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
37dfac74
Commit
37dfac74
authored
Jan 11, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X due modifiers: Adjust δdays ~ importance
parent
2b692ce8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
topydo/lib/Importance.py
topydo/lib/Importance.py
+17
-16
topydo/lib/Todo.py
topydo/lib/Todo.py
+4
-1
No files found.
topydo/lib/Importance.py
View file @
37dfac74
...
...
@@ -41,7 +41,7 @@ def is_due_next_monday(p_todo):
p_todo
.
days_till_due
()
<=
3
def
importance
(
p_todo
,
p_ignore_weekend
=
config
().
ignore_weekends
()):
def
importance
(
p_todo
,
p_ignore_weekend
=
config
().
ignore_weekends
()
,
p_ignore_due
=
False
):
"""
Calculates the importance of the given task.
Returns an importance of zero when the task has been completed.
...
...
@@ -56,22 +56,23 @@ def importance(p_todo, p_ignore_weekend=config().ignore_weekends()):
priority
=
p_todo
.
priority
()
result
+=
IMPORTANCE_VALUE
[
priority
]
if
priority
in
IMPORTANCE_VALUE
else
0
if
p_todo
.
has_tag
(
config
().
tag_due
()):
days_left
=
p_todo
.
days_till_due
()
if
days_left
>=
7
and
days_left
<
14
:
if
not
p_ignore_due
:
if
p_todo
.
has_tag
(
config
().
tag_due
()):
days_left
=
p_todo
.
days_till_due
()
if
days_left
>=
7
and
days_left
<
14
:
# [1w, 2w)
result
+=
1
elif
days_left
>=
2
and
days_left
<
7
:
# [2d, 1w)
result
+=
2
elif
days_left
>=
1
and
days_left
<
2
:
# [1d, 2d)
result
+=
3
elif
days_left
>=
0
and
days_left
<
1
:
# [0d, 1d)
result
+=
5
elif
days_left
<
0
:
# [-oo, 0)
result
+=
6
if
p_ignore_weekend
and
is_due_next_monday
(
p_todo
):
result
+=
1
elif
days_left
>=
2
and
days_left
<
7
:
result
+=
2
elif
days_left
>=
1
and
days_left
<
2
:
result
+=
3
elif
days_left
>=
0
and
days_left
<
1
:
result
+=
5
elif
days_left
<
0
:
result
+=
6
if
p_ignore_weekend
and
is_due_next_monday
(
p_todo
):
result
+=
1
if
p_todo
.
has_tag
(
config
().
tag_star
()):
result
+=
1
...
...
topydo/lib/Todo.py
View file @
37dfac74
...
...
@@ -23,6 +23,7 @@ from datetime import date, timedelta
from
topydo.lib.Config
import
config
from
topydo.lib.TodoBase
import
TodoBase
from
topydo.lib.Utils
import
date_string_to_date
from
topydo.lib.Importance
import
importance
class
Todo
(
TodoBase
):
...
...
@@ -73,7 +74,9 @@ class Todo(TodoBase):
return
tstart
tdue
,
flags
=
self
.
_due_date
()
if
'on'
in
flags
:
tstart
=
tdue
-
timedelta
(
days
=
1
)
# δdays ~ importance
ddays
=
max
(
1
,
importance
(
self
,
p_ignore_due
=
True
)
-
1
)
tstart
=
tdue
-
timedelta
(
days
=
ddays
)
return
tstart
def
due_date
(
self
):
...
...
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