mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +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
|
return
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.execute("""SELECT id, task FROM todo
|
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:
|
if cursor.rowcount == 0:
|
||||||
irc.reply(msg, 'You have no tasks in your todo list.')
|
irc.reply(msg, 'You have no tasks in your todo list.')
|
||||||
return
|
return
|
||||||
@ -136,7 +137,8 @@ class Todo(callbacks.Privmsg):
|
|||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
if userid:
|
if userid:
|
||||||
cursor.execute("""SELECT id, task FROM todo
|
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:
|
if cursor.rowcount == 0:
|
||||||
irc.reply(msg, 'That user has no todos.')
|
irc.reply(msg, 'That user has no todos.')
|
||||||
return
|
return
|
||||||
|
@ -48,15 +48,15 @@ if sqlite is not None:
|
|||||||
def testTodo(self):
|
def testTodo(self):
|
||||||
# Should not error, but no tasks yet.
|
# Should not error, but no tasks yet.
|
||||||
self.assertNotError('todo')
|
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
|
# Add a task
|
||||||
self.assertNotError('todo add wash my car')
|
self.assertNotError('todo add wash my car')
|
||||||
self.assertRegexp('todo', '#1: wash my car')
|
self.assertResponse('todo', '#1: wash my car')
|
||||||
# Check that task
|
# Check that task
|
||||||
self.assertRegexp('todo 1',
|
self.assertRegexp('todo 1',
|
||||||
'Todo for tester: wash my car \(Added .*?\)')
|
'Todo for tester: wash my car \(Added .*?\)')
|
||||||
# Check that it lists all my tasks when given my name
|
# 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')
|
'#1: wash my car')
|
||||||
# Check pluralization
|
# Check pluralization
|
||||||
self.assertNotError('todo add moo')
|
self.assertNotError('todo add moo')
|
||||||
@ -66,6 +66,10 @@ if sqlite is not None:
|
|||||||
self.assertError('todo asfas')
|
self.assertError('todo asfas')
|
||||||
self.assertResponse('todo asfas', 'Error: \'asfas\' is not a '
|
self.assertResponse('todo asfas', 'Error: \'asfas\' is not a '
|
||||||
'valid task id or username')
|
'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):
|
def testAddtodo(self):
|
||||||
self.assertNotError('todo add code a new plugin')
|
self.assertNotError('todo add code a new plugin')
|
||||||
|
Loading…
Reference in New Issue
Block a user