mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-03 13:00:41 +01:00
Fixed uptime sorting.
This commit is contained in:
parent
a3aeaee2b0
commit
6d3cb48c51
@ -1,3 +1,7 @@
|
||||
* Fixed sorting in Status' uptime database.
|
||||
|
||||
* Updated the Gameknot tests for expired games.
|
||||
|
||||
* Added a 'server' attribute to Irc objects to unify the way to
|
||||
access such information.
|
||||
|
||||
|
@ -84,16 +84,13 @@ class UptimeDB(object):
|
||||
|
||||
def top(self, n=3):
|
||||
def decorator(t):
|
||||
if t[1] is None:
|
||||
return 0.0
|
||||
else:
|
||||
t[1] - t[0]
|
||||
return t[1] - t[0]
|
||||
def invertCmp(cmp):
|
||||
def f(x, y):
|
||||
return -cmp(x, y)
|
||||
return f
|
||||
def notNone(t):
|
||||
return t[1] is not None
|
||||
return t[1] is not None and t[0] != 0
|
||||
utils.sortBy(decorator, self.uptimes, cmp=invertCmp(cmp))
|
||||
return list(islice(ifilter(notNone, self.uptimes), n))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user