This is an automated email from the ASF dual-hosted git repository.
humbedooh 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 70fefae fix top 10 author sort
70fefae is described below
commit 70fefaefa748b80a52f8a6d6335ca5ae9c75a50d
Author: Daniel Gruno <[email protected]>
AuthorDate: Tue Dec 14 00:25:02 2021 +0100
fix top 10 author sort
---
server/endpoints/stats.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/server/endpoints/stats.py b/server/endpoints/stats.py
index b002e4e..e5a1b26 100644
--- a/server/endpoints/stats.py
+++ b/server/endpoints/stats.py
@@ -94,12 +94,13 @@ async def process(
# author entries are now [count, gravatar]
# as we cannot reconstruct the correct gravatar from an anonymised
address
- all_authors = sorted(authors.items(), key=lambda x: x[0][1],
reverse=True) # sort in reverse by author count
+ all_authors = sorted(authors.items(), key=lambda x: x[1][0],
reverse=True) # sort in reverse by author count
+ print(all_authors)
top10_authors = []
for author, data in all_authors[:10]:
name, address = email.utils.parseaddr(author)
top10_authors.append(
- {"email": address, "name": name, "count": data[0], "gravatar":
data[1],}
+ {"email": address, "name": name, "count": data[0], "gravatar":
data[1]}
)
# Trim email data so as to reduce download sizes