fix sorting
This commit is contained in:
parent
852cfaed2a
commit
179752f35e
1 changed files with 1 additions and 2 deletions
|
@ -192,14 +192,13 @@ def run_forever(address: str, period: int, ssid: str, output: str):
|
|||
|
||||
leaderboard_entry = namedtuple('leaderboard_entry', ('name', 'total'))
|
||||
leaderboard = []
|
||||
for mac, minutes in leaderboard_tmp.items():
|
||||
for mac, minutes in sorted(leaderboard_tmp.items(), key=lambda t: t[1], reverse=True):
|
||||
leaderboard.append(
|
||||
leaderboard_entry(
|
||||
mac_to_hostname.get(mac) or mac,
|
||||
humanize.naturaldelta(timedelta(minutes=minutes))
|
||||
)
|
||||
)
|
||||
leaderboard.sort(key=lambda l: l.total, reverse=True)
|
||||
leaderboard = leaderboard[:10]
|
||||
|
||||
logging.debug(f"Outputting HTML file into {output_file}...")
|
||||
|
|
Loading…
Reference in a new issue