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/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new a7f04fb7 Allow for missing cohort data
a7f04fb7 is described below

commit a7f04fb7ff2f5e545e83db26a2128f192aea1223
Author: Sebb <[email protected]>
AuthorDate: Sun Feb 12 13:53:10 2023 +0000

    Allow for missing cohort data
---
 www/members/list-traffic.cgi | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/www/members/list-traffic.cgi b/www/members/list-traffic.cgi
index 6fc9519e..a39543fb 100755
--- a/www/members/list-traffic.cgi
+++ b/www/members/list-traffic.cgi
@@ -149,6 +149,8 @@ end
 # produce HTML
 _html do
   _body? do
+    # looks like cohorts are no longer being set up, so allow for this
+    attendance = ASF::MeetingUtil.get_attendance(ASF::SVN['Meetings'])
     _whimsy_body(
       title: PAGETITLE,
       related: {
@@ -169,19 +171,22 @@ _html do
           _ 'Senders of more than 20%, 10%, or 5% of all emails in a week are 
highlighted in the '
           _a 'By week view (supply ?week in URL).', href: '?week'
         end
-        _p do
-          _ 'For the All Senders column, Members are colorized by approximate 
years of membership like so: '
-          _br
-          COHORT_STYLES.each do |name, style|
-            _span "#{name}, ", class: style
+        if attendance.has_key?('cohorts')
+          _p do
+            _ 'For the All Senders column, Members are colorized by 
approximate years of membership like so: '
+            _br
+            COHORT_STYLES.each do |name, style|
+              _span "#{name}, ", class: style
+            end
+            _ ' note that due to email address variations, some entries may be 
incorrectly marked.'
           end
-          _ ' note that due to email address variations, some entries may be 
incorrectly marked.'
+        else
+          attendance['cohorts'] = {} unless attendance.has_key?('cohorts') # 
Allow to fail silently if data missing
         end
       }
     ) do
       months = Dir["#{SRV_MAIL}/*"].map {|path| 
File.basename(path)}.grep(/^\d+$/)
-      attendance = ASF::MeetingUtil.get_attendance(ASF::SVN['Meetings'])
-      style_cohorts(attendance) if attendance.has_key?('cohorts') # Allow to 
fail silently if data missing
+      style_cohorts(attendance)
       # if ENV['QUERY_STRING'].include? 'Clear-Cache-No-Really'
       #   _p do # Danger, Will Robinson!
       #     _ 'Note: deleting cached .json files: '

Reply via email to