Commit 5a7aeb10 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Assign tasks with no priority to lowest priority for sake of sorting.

parent 61270ddc
......@@ -144,3 +144,14 @@ class SorterTest(unittest.TestCase):
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))
(B) Foo
Baz
(D) Bar
......@@ -34,7 +34,8 @@ def get_field_function(p_field):
result = lambda a: a
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':
# when a task has no creation date, push it to the end by assigning it
# the maximum possible date.
......
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