You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/18 22:36:30 UTC

[incubator-ponymail-foal] branch humbedooh/monthly_stats updated: refactor to fit new message activity function

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch humbedooh/monthly_stats
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/humbedooh/monthly_stats by this push:
     new 49113e6  refactor to fit new message activity function
49113e6 is described below

commit 49113e689a53fc07abe32c2926df150bb37df5b5
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sat Sep 18 17:36:27 2021 -0500

    refactor to fit new message activity function
---
 server/endpoints/stats.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/server/endpoints/stats.py b/server/endpoints/stats.py
index 171280b..14c8af3 100644
--- a/server/endpoints/stats.py
+++ b/server/endpoints/stats.py
@@ -46,7 +46,7 @@ async def process(
     wordcloud = None
     if server.config.ui.wordcloud:
         wordcloud = await plugins.messages.wordcloud(session, query_defuzzed)
-    first_year, last_year, first_month, last_month = await plugins.messages.get_years(session, query_defuzzed_nodate)
+    oldest, youngest, active_months = await plugins.messages.get_activity_span(session, query_defuzzed_nodate)
 
     threads = plugins.messages.ThreadConstructor(results)
     tstruct, authors = await server.runners.run(threads.construct)
@@ -66,10 +66,11 @@ async def process(
         plugins.messages.trim_email(msg, external=True)
 
     return {
-        "firstYear": first_year,
-        "lastYear": last_year,
-        "firstMonth": first_month,
-        "lastMonth": last_month,
+        "firstYear": oldest.year,
+        "lastYear": youngest.year,
+        "firstMonth": oldest.month,
+        "lastMonth": youngest.month,
+        "active_months": active_months,
         "hits": len(results),
         "numparts": len(authors),
         "no_threads": len(tstruct),