I thought this already sorted by id...

This commit is contained in:
James Vega 2004-02-17 02:41:09 +00:00
parent ef550c2dc0
commit 62f3242b81
2 changed files with 4 additions and 3 deletions

View File

@ -322,7 +322,7 @@ class Note(callbacks.Privmsg):
temp[note[1]] = [note[0]] temp[note[1]] = [note[0]]
notes = [] notes = []
for (k,v) in temp.iteritems(): for (k,v) in temp.iteritems():
notes.append('%s %s' % (', '.join(v), k)) notes.append('%s %s' % (utils.commaAndify(v), k))
return notes return notes
def _sentnotes(self, irc, msg, receiver): def _sentnotes(self, irc, msg, receiver):
@ -345,6 +345,7 @@ class Note(callbacks.Privmsg):
irc.error('That user is not in my user database.') irc.error('That user is not in my user database.')
return return
sql = '%s %s' % (sql, 'AND notes.to_id=%r' % receiver) sql = '%s %s' % (sql, 'AND notes.to_id=%r' % receiver)
sql = '%s ORDER BY id DESC' % sql
db = self.dbHandler.getDb() db = self.dbHandler.getDb()
cursor = db.cursor() cursor = db.cursor()
cursor.execute(sql) cursor.execute(sql)
@ -377,6 +378,7 @@ class Note(callbacks.Privmsg):
irc.error('That user is not in my user database.') irc.error('That user is not in my user database.')
return return
sql = '%s %s' % (sql, 'AND notes.from_id=%r' % sender) sql = '%s %s' % (sql, 'AND notes.from_id=%r' % sender)
sql = '%s ORDER BY id DESC' % sql
db = self.dbHandler.getDb() db = self.dbHandler.getDb()
cursor = db.cursor() cursor = db.cursor()
cursor.execute(sql) cursor.execute(sql)
@ -386,7 +388,6 @@ class Note(callbacks.Privmsg):
else: else:
ids = [self._formatNoteData(msg, *t) for t in cursor.fetchall()] ids = [self._formatNoteData(msg, *t) for t in cursor.fetchall()]
#self.log.warning(ids) #self.log.warning(ids)
ids.reverse()
ids = self._condense(ids) ids = self._condense(ids)
irc.reply(utils.commaAndify(ids)) irc.reply(utils.commaAndify(ids))

View File

@ -70,7 +70,7 @@ if sqlite is not None:
_ = self.getMsg(' ') _ = self.getMsg(' ')
self.assertNotError('note send inkedmn 1,2,3') self.assertNotError('note send inkedmn 1,2,3')
_ = self.getMsg(' ') _ = self.getMsg(' ')
self.assertRegexp('note list --sent', r'#1.*#2') self.assertRegexp('note list --sent', r'#2.*#1')
self.assertRegexp('note list', r'#1.*#2') self.assertRegexp('note list', r'#1.*#2')
self.assertRegexp('note 1', 'testing') self.assertRegexp('note 1', 'testing')
self.assertResponse('note list --old', '#1 from inkedmn') self.assertResponse('note list --old', '#1 from inkedmn')