mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fixed bug in info; returned n+1 factoids when there were only n.
This commit is contained in:
parent
e255ef2e68
commit
65b87f822c
@ -339,12 +339,12 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
ORDER BY id""", id)
|
||||
factoids = cursor.fetchall()
|
||||
L = []
|
||||
counter = 1
|
||||
counter = 0
|
||||
for (added_by, added_at) in factoids:
|
||||
counter += 1
|
||||
added_at = time.strftime(conf.humanTimestampFormat,
|
||||
time.localtime(int(added_at)))
|
||||
L.append('#%s was added by %s at %s' % (counter,added_by,added_at))
|
||||
counter += 1
|
||||
factoids = '; '.join(L)
|
||||
s = 'Key %r is %s and has %s factoids associated with it: %s' % \
|
||||
(key, locked and 'locked' or 'not locked', counter, factoids)
|
||||
|
@ -105,6 +105,10 @@ if sqlite is not None:
|
||||
self.assertNotRegexp('info foo', '#0')
|
||||
self.assertNotRegexp('whatis foo', '#0')
|
||||
|
||||
def testInfoReturnsRightNumber(self):
|
||||
self.assertNotError('learn foo as bar')
|
||||
self.assertNotRegexp('info foo', '2 factoids')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user