whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curc...@apache.org
Subject [whimsy] branch parse-pre-2007 updated: Avoid NaN before committee reports are parsed fully
Date Wed, 04 Apr 2018 13:56:27 GMT
This is an automated email from the ASF dual-hosted git repository.

curcuru pushed a commit to branch parse-pre-2007
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/parse-pre-2007 by this push:
     new 2379856  Avoid NaN before committee reports are parsed fully
2379856 is described below

commit 237985651ed52312bcb4ef3b6c469cd1b38c95ab
Author: Shane Curcuru <asf@shanecurcuru.org>
AuthorDate: Wed Apr 4 09:56:21 2018 -0400

    Avoid NaN before committee reports are parsed fully
---
 lib/whimsy/asf/agenda/summary.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/agenda/summary.rb b/lib/whimsy/asf/agenda/summary.rb
index be2b010..5b1acfd 100644
--- a/lib/whimsy/asf/agenda/summary.rb
+++ b/lib/whimsy/asf/agenda/summary.rb
@@ -138,9 +138,11 @@ class ASF::Board::Agenda
         totcommentlen += data[COMMENT_LEN] if data[COMMENT_LEN]
         totreportlen += data[REPORT_LEN] if data[REPORT_LEN]
       end
-      summary[STATS_KEY]['avgapprovals'] = (totapprovals / totreports).round(2)
-      summary[STATS_KEY]['avgcommentlen'] = (totcommentlen / totreports).round(0)
-      summary[STATS_KEY]['avgreportlen'] = (totreportlen / totreports).round(0)
+      if totreports != 0 # Avoid NaN in minutes that aren't parsed fully
+        summary[STATS_KEY]['avgapprovals'] = (totapprovals / totreports).round(2)
+        summary[STATS_KEY]['avgcommentlen'] = (totcommentlen / totreports).round(0)
+        summary[STATS_KEY]['avgreportlen'] = (totreportlen / totreports).round(0)
+      end
     rescue StandardError => e
       summary[ERRORS_KEY] ||= "ERROR(#{meeting}) process error: #{e.message} #{e.backtrace[0]}"
     end

-- 
To stop receiving notification emails like this one, please contact
curcuru@apache.org.

Mime
View raw message