mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
ChannelStats: Fix rank to work with selfStats
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit 41fd218b8d
)
Signed-off-by: Daniel Folkinshteyn <nanotube@users.sourceforge.net>
This commit is contained in:
parent
5d15bbf1b2
commit
fc1a049d3c
@ -315,7 +315,8 @@ class ChannelStats(callbacks.Plugin):
|
||||
expr = expr.lower()
|
||||
users = []
|
||||
for ((c, id), stats) in self.db.items():
|
||||
if ircutils.strEqual(c, channel) and ircdb.users.hasUser(id):
|
||||
if ircutils.strEqual(c, channel) and \
|
||||
(id == 0 or ircdb.users.hasUser(id)):
|
||||
e = self._env.copy()
|
||||
for attr in stats._values:
|
||||
e[attr] = float(getattr(stats, attr))
|
||||
@ -327,7 +328,10 @@ class ChannelStats(callbacks.Plugin):
|
||||
irc.errorInvalid('stat variable', str(e).split()[1])
|
||||
except Exception, e:
|
||||
irc.error(utils.exnToString(e), Raise=True)
|
||||
users.append((v, ircdb.users.getUser(id).name))
|
||||
if id == 0:
|
||||
users.append((v, irc.nick))
|
||||
else:
|
||||
users.append((v, ircdb.users.getUser(id).name))
|
||||
users.sort()
|
||||
users.reverse()
|
||||
s = utils.str.commaAndify(['#%s %s (%.3g)' % (i+1, u, v)
|
||||
|
@ -1,5 +1,6 @@
|
||||
###
|
||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||
# Copyright (c) 2010, James Vega
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -61,6 +62,7 @@ class ChannelStatsTestCase(ChannelPluginTestCase):
|
||||
self.assertNotError('channelstats stats %s' % self.irc.nick)
|
||||
self.assertNotError('channelstats stats %s' % self.irc.nick)
|
||||
self.assertNotError('channelstats stats %s' % self.irc.nick.upper())
|
||||
self.assertRegexp('channelstats rank chars', self.irc.nick)
|
||||
u = ircdb.users.getUser(self.prefix)
|
||||
u.addCapability(ircdb.makeChannelCapability(self.channel, 'op'))
|
||||
ircdb.users.setUser(u)
|
||||
|
Loading…
Reference in New Issue
Block a user