sort karma reversed and by abs()

This commit is contained in:
jesopo 2020-09-29 15:36:43 +00:00
parent e50c4ecbe2
commit 777c14b680

View file

@ -129,7 +129,9 @@ class Module(ModuleManager.BaseModule):
def karmawho(self, event):
target = event["spec"][0]
karma = self._get_karma(event["server"], target, True)
karma = sorted(list(karma.items()), key=lambda k: k[1])
karma = sorted(list(karma.items()),
key=lambda k: abs(k[1]),
reverse=True)
parts = ["%s (%d)" % (n, v) for n, v in karma]
event["stdout"].write("%s has karma from: %s" %