mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-29 21:54:22 +01:00
Fixed ordering by priority when requesting todos for a person (or self)
This commit is contained in:
parent
70be390875
commit
8cc9620a4b
@ -125,7 +125,8 @@ class Todo(callbacks.Privmsg):
|
||||
return
|
||||
cursor = self.db.cursor()
|
||||
cursor.execute("""SELECT id, task FROM todo
|
||||
WHERE userid = %s AND active = 1""", id)
|
||||
WHERE userid = %s AND active = 1
|
||||
ORDER BY priority, id""", id)
|
||||
if cursor.rowcount == 0:
|
||||
irc.reply(msg, 'You have no tasks in your todo list.')
|
||||
return
|
||||
@ -136,7 +137,8 @@ class Todo(callbacks.Privmsg):
|
||||
cursor = self.db.cursor()
|
||||
if userid:
|
||||
cursor.execute("""SELECT id, task FROM todo
|
||||
WHERE userid = %s AND active = 1""", userid)
|
||||
WHERE userid = %s AND active = 1
|
||||
ORDER BY priority, id""", userid)
|
||||
if cursor.rowcount == 0:
|
||||
irc.reply(msg, 'That user has no todos.')
|
||||
return
|
||||
|
@ -48,15 +48,15 @@ if sqlite is not None:
|
||||
def testTodo(self):
|
||||
# Should not error, but no tasks yet.
|
||||
self.assertNotError('todo')
|
||||
self.assertRegexp('todo', 'You have no tasks in your todo list.')
|
||||
self.assertResponse('todo', 'You have no tasks in your todo list.')
|
||||
# Add a task
|
||||
self.assertNotError('todo add wash my car')
|
||||
self.assertRegexp('todo', '#1: wash my car')
|
||||
self.assertResponse('todo', '#1: wash my car')
|
||||
# Check that task
|
||||
self.assertRegexp('todo 1',
|
||||
'Todo for tester: wash my car \(Added .*?\)')
|
||||
# Check that it lists all my tasks when given my name
|
||||
self.assertRegexp('todo tester', 'Todo for tester: '
|
||||
self.assertResponse('todo tester', 'Todo for tester: '
|
||||
'#1: wash my car')
|
||||
# Check pluralization
|
||||
self.assertNotError('todo add moo')
|
||||
@ -66,6 +66,10 @@ if sqlite is not None:
|
||||
self.assertError('todo asfas')
|
||||
self.assertResponse('todo asfas', 'Error: \'asfas\' is not a '
|
||||
'valid task id or username')
|
||||
# Check priority sorting
|
||||
self.assertNotError('todo setpriority 1 100')
|
||||
self.assertNotError('todo setpriority 2 10')
|
||||
self.assertResponse('todo', '#2: moo and #1: wash my car')
|
||||
|
||||
def testAddtodo(self):
|
||||
self.assertNotError('todo add code a new plugin')
|
||||
|
Loading…
Reference in New Issue
Block a user