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
5a7aeb10
Commit
5a7aeb10
authored
Nov 01, 2014
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign tasks with no priority to lowest priority for sake of sorting.
parent
61270ddc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
4 deletions
+22
-4
test/SorterTest.py
test/SorterTest.py
+14
-3
test/data/SorterTest12-result.txt
test/data/SorterTest12-result.txt
+3
-0
test/data/SorterTest12.txt
test/data/SorterTest12.txt
+3
-0
topydo/lib/Sorter.py
topydo/lib/Sorter.py
+2
-1
No files found.
test/SorterTest.py
View file @
5a7aeb10
# Topydo - A todo.txt client written in Python.
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
# Copyright (C) 2014 Bram Schoenmakers <me@bramschoenmakers.nl>
#
#
# This program is free software: you can redistribute it and/or modify
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
...
@@ -144,3 +144,14 @@ class SorterTest(unittest.TestCase):
...
@@ -144,3 +144,14 @@ class SorterTest(unittest.TestCase):
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
result
))
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
result
))
def
test_sort16
(
self
):
"""
Check sort of low priority tasks (D or lower) with non-priority tasks.
"""
sorter
=
Sorter
.
Sorter
(
'desc:importance,desc:prio'
)
todolist
=
load_file_to_todolist
(
'data/SorterTest12.txt'
)
view
=
todolist
.
view
(
sorter
,
[])
result
=
load_file
(
'data/SorterTest12-result.txt'
)
self
.
assertEquals
(
str
(
view
),
todolist_to_string
(
result
))
test/data/SorterTest12-result.txt
0 → 100644
View file @
5a7aeb10
(B) Foo
(D) Bar
Baz
test/data/SorterTest12.txt
0 → 100644
View file @
5a7aeb10
(B) Foo
Baz
(D) Bar
topydo/lib/Sorter.py
View file @
5a7aeb10
...
@@ -34,7 +34,8 @@ def get_field_function(p_field):
...
@@ -34,7 +34,8 @@ def get_field_function(p_field):
result
=
lambda
a
:
a
result
=
lambda
a
:
a
if
is_priority_field
(
p_field
):
if
is_priority_field
(
p_field
):
result
=
lambda
a
:
a
.
priority
()
# assign dummy priority when a todo has no priority
result
=
lambda
a
:
a
.
priority
()
or
'ZZ'
elif
p_field
==
'creationdate'
or
p_field
==
'creation'
:
elif
p_field
==
'creationdate'
or
p_field
==
'creation'
:
# when a task has no creation date, push it to the end by assigning it
# when a task has no creation date, push it to the end by assigning it
# the maximum possible date.
# the maximum possible date.
...
...
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