mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Closed #860139 - including wordstat count in stat output as well as rank. Also
made it so that if your name already appears in the top N results that it doesn't append that rank stuff.
This commit is contained in:
parent
00028614c5
commit
35ecd7bd98
@ -604,14 +604,21 @@ class ChannelDB(plugins.ChannelDBHandler,
|
|||||||
try:
|
try:
|
||||||
id = ircdb.users.getUserId(msg.prefix)
|
id = ircdb.users.getUserId(msg.prefix)
|
||||||
rank = 1
|
rank = 1
|
||||||
for (_, userId) in results:
|
s = "" # Don't say anything if they show in the output
|
||||||
|
# already
|
||||||
|
seenUser = False
|
||||||
|
for (count, userId) in results:
|
||||||
if userId == id:
|
if userId == id:
|
||||||
s = 'You are ranked %s out of %s.' % \
|
seenUser = True
|
||||||
(rank, utils.nItems(ers, len(results)))
|
if rank > numResultsShown:
|
||||||
|
s = 'You are ranked %s out of %s with %s.' % \
|
||||||
|
(rank, utils.nItems(ers, len(results)),
|
||||||
|
utils.nItems(repr(word), count))
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
rank += 1
|
rank += 1
|
||||||
else:
|
else:
|
||||||
|
if not seenUser:
|
||||||
s = 'You have not said %r' % word
|
s = 'You have not said %r' % word
|
||||||
ret = '%s %s. %s' % (ret, utils.commaAndify(L), s)
|
ret = '%s %s. %s' % (ret, utils.commaAndify(L), s)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -135,8 +135,11 @@ if sqlite is not None:
|
|||||||
'3.*%s: 10.*%s: 5.*foo: 3' %
|
'3.*%s: 10.*%s: 5.*foo: 3' %
|
||||||
(userNick2, userNick1))
|
(userNick2, userNick1))
|
||||||
# Check for the extra-swanky stuff too
|
# Check for the extra-swanky stuff too
|
||||||
|
# (note: to do so we must make sure they don't appear in the list,
|
||||||
|
# so we'll tweak the config)
|
||||||
|
self.assertNotError('channeldb config wordstats-top-n 2')
|
||||||
self.assertRegexp('wordstats lol',
|
self.assertRegexp('wordstats lol',
|
||||||
'total.*19 \'lol\'s.*%s: 10.*%s: 5.*foo: 4.*'
|
'total.*19 \'lol\'s.*%s: 10.*%s: 5.*'
|
||||||
'ranked 3 out of 3 \'lol\'ers' % \
|
'ranked 3 out of 3 \'lol\'ers' % \
|
||||||
(userNick2, userNick1))
|
(userNick2, userNick1))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user