You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/06/04 14:04:49 UTC
[incubator-ponymail-foal] branch master updated: Simplify
incomprehensible comprehension
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new d7187b2 Simplify incomprehensible comprehension
d7187b2 is described below
commit d7187b2ef4c3530f2ba049820e619c125b6aa44d
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 4 15:04:34 2021 +0100
Simplify incomprehensible comprehension
---
server/endpoints/stats.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/server/endpoints/stats.py b/server/endpoints/stats.py
index 185866a..c73b30c 100644
--- a/server/endpoints/stats.py
+++ b/server/endpoints/stats.py
@@ -49,10 +49,9 @@ async def process(server: plugins.server.BaseServer, session: plugins.session.Se
xlist = indata.get("list", "*")
xdomain = indata.get("domain", "*")
- all_authors = sorted([[author, count] for author, count in authors.items()], key=lambda x: x[1])
+ all_authors = sorted(authors.items(), key=lambda x: -x[1]) # negative prefix for reverse sort
top10_authors = []
- for x in [x for x in reversed([x for x in all_authors])][:10]:
- author, count = x
+ for author, count in all_authors[:10]:
name, address = email.utils.parseaddr(author)
top10_authors.append(
{"email": address, "name": name, "count": count, "gravatar": plugins.mbox.gravatar(author),}