Commit 6a474492 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Sort case insensitively on todo texts

parent 69715c07
First first
(A) Foo (A) Foo
2014-06-14 Last 2014-06-14 Last
(A) Foo (A) Foo
2014-06-14 Last 2014-06-14 Last
First first
...@@ -33,14 +33,14 @@ class SortCommandTest(CommandTest): ...@@ -33,14 +33,14 @@ class SortCommandTest(CommandTest):
command.execute() command.execute()
self.assertEqual(self.todolist.print_todos(), self.assertEqual(self.todolist.print_todos(),
"First\n(A) Foo\n2014-06-14 Last") "first\n(A) Foo\n2014-06-14 Last")
def test_sort2(self): def test_sort2(self):
command = SortCommand([], self.todolist, self.out, self.error) command = SortCommand([], self.todolist, self.out, self.error)
command.execute() command.execute()
self.assertEqual(self.todolist.print_todos(), self.assertEqual(self.todolist.print_todos(),
"(A) Foo\n2014-06-14 Last\nFirst") "(A) Foo\n2014-06-14 Last\nfirst")
def test_sort3(self): def test_sort3(self):
""" Check that order does not influence the UID of a todo. """ """ Check that order does not influence the UID of a todo. """
......
...@@ -57,7 +57,7 @@ def get_field_function(p_field): ...@@ -57,7 +57,7 @@ def get_field_function(p_field):
elif p_field == 'project' or p_field == 'projects': elif p_field == 'project' or p_field == 'projects':
result = lambda a: sorted([c.lower() for c in a.projects()]) result = lambda a: sorted([c.lower() for c in a.projects()])
elif p_field == 'text': elif p_field == 'text':
result = lambda a: a.text() result = lambda a: a.text().lower()
else: else:
# try to find the corresponding tag # try to find the corresponding tag
# when a tag is not present, push it to the end of the list by giving # when a tag is not present, push it to the end of the list by giving
......
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