You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2017/10/21 08:29:57 UTC

[kibble] branch master updated: prevent divide-by-zero in case of 0 contributors

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


The following commit(s) were added to refs/heads/master by this push:
     new 67fcbad  prevent divide-by-zero in case of 0 contributors
67fcbad is described below

commit 67fcbad043d421a16b5ec2f26894e7daf94bc94c
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sat Oct 21 10:29:49 2017 +0200

    prevent divide-by-zero in case of 0 contributors
---
 api/pages/code/retention.py  | 2 +-
 api/pages/issue/retention.py | 2 +-
 api/pages/mail/retention.py  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/api/pages/code/retention.py b/api/pages/code/retention.py
index b70aea2..5184af9 100644
--- a/api/pages/code/retention.py
+++ b/api/pages/code/retention.py
@@ -227,7 +227,7 @@ def run(API, environ, indata, session):
             if allPeople[person] <= time.time() - el[1]:
                 counts[el[0]] = counts.get(el[0], 0) + 1
                 break
-    avgyr = (totExp / (86400*365)) / len(activePeople)
+    avgyr = (totExp / (86400*365)) / max(len(activePeople),1)
     
     ts = sorted(ts, key = lambda x: x['date'])
     avgm = ""
diff --git a/api/pages/issue/retention.py b/api/pages/issue/retention.py
index a3a6f5a..b17a1bf 100644
--- a/api/pages/issue/retention.py
+++ b/api/pages/issue/retention.py
@@ -239,7 +239,7 @@ def run(API, environ, indata, session):
             if allPeople[person] <= time.time() - el[1]:
                 counts[el[0]] = counts.get(el[0], 0) + 1
                 break
-    avgyr = (totExp / (86400*365)) / len(activePeople)
+    avgyr = (totExp / (86400*365)) / max(len(activePeople),1)
     
     ts = sorted(ts, key = lambda x: x['date'])
     
diff --git a/api/pages/mail/retention.py b/api/pages/mail/retention.py
index 79238f0..238db3e 100644
--- a/api/pages/mail/retention.py
+++ b/api/pages/mail/retention.py
@@ -223,7 +223,7 @@ def run(API, environ, indata, session):
             if allPeople[person] <= time.time() - el[1]:
                 counts[el[0]] = counts.get(el[0], 0) + 1
                 break
-    avgyr = (totExp / (86400*365)) / len(activePeople)
+    avgyr = (totExp / (86400*365)) / max(len(activePeople),1)
     
     ts = sorted(ts, key = lambda x: x['date'])
     

-- 
To stop receiving notification emails like this one, please contact
['"commits@kibble.apache.org" <co...@kibble.apache.org>'].