mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-03 21:10:40 +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
|
* Added a 'server' attribute to Irc objects to unify the way to
|
||||||
access such information.
|
access such information.
|
||||||
|
|
||||||
|
@ -84,16 +84,13 @@ class UptimeDB(object):
|
|||||||
|
|
||||||
def top(self, n=3):
|
def top(self, n=3):
|
||||||
def decorator(t):
|
def decorator(t):
|
||||||
if t[1] is None:
|
return t[1] - t[0]
|
||||||
return 0.0
|
|
||||||
else:
|
|
||||||
t[1] - t[0]
|
|
||||||
def invertCmp(cmp):
|
def invertCmp(cmp):
|
||||||
def f(x, y):
|
def f(x, y):
|
||||||
return -cmp(x, y)
|
return -cmp(x, y)
|
||||||
return f
|
return f
|
||||||
def notNone(t):
|
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))
|
utils.sortBy(decorator, self.uptimes, cmp=invertCmp(cmp))
|
||||||
return list(islice(ifilter(notNone, self.uptimes), n))
|
return list(islice(ifilter(notNone, self.uptimes), n))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user