commit a1ace07dcc3751e64ed914d1dbad828c74557001 Author: Damian Johnson atagar@torproject.org Date: Tue Oct 3 10:17:03 2017 -0700
Fix email list counts
Oops, list counts were only the last month. Not all of them. --- scripts/email_activity.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/email_activity.py b/scripts/email_activity.py index e40fac7..70f1e4f 100644 --- a/scripts/email_activity.py +++ b/scripts/email_activity.py @@ -27,6 +27,8 @@ all_emails = [] emails_for_list = {} # {author => {list => count}}
for email_list in EMAIL_LISTS: + all_list_authors = [] + for month_offset in range(6): d = date.today() - relativedelta.relativedelta(months = month_offset) url = "https://lists.torproject.org/pipermail/%s/%s/author.html" % (email_list, d.strftime("%Y-%B")) @@ -35,9 +37,10 @@ for email_list in EMAIL_LISTS: list_authors = AUTHOR.findall(request.read())
all_emails += list_authors + all_list_authors += list_authors
- for author, count in collections.Counter(list_authors).items(): - emails_for_list.setdefault(author, {})[email_list] = count + for author, count in collections.Counter(all_list_authors).items(): + emails_for_list.setdefault(author, {})[email_list] = count
for author, count in sorted(collections.Counter(all_emails).items(), key = lambda entry: entry[1], reverse = True): list_counts = ['%s %s' % (c, a) for (a, c) in sorted(emails_for_list.get(author, {}).items(), key = lambda e: e[1], reverse = True)]