You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by hu...@apache.org on 2019/07/31 14:49:13 UTC

svn commit: r1864070 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/generators.js wizard.js

Author: humbedooh
Date: Wed Jul 31 14:49:13 2019
New Revision: 1864070

URL: http://svn.apache.org/viewvc?rev=1864070&view=rev
Log:
deal with NaN

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js?rev=1864070&r1=1864069&r2=1864070&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js Wed Jul 31 14:49:13 2019
@@ -98,12 +98,16 @@ function health_tips(data) {
         let a = ml.split('-', 2);
         ml = "%s@%s.apache.org".format(a[1], a[0]);
         let pct_change =Math.floor( 100 * ( (mldata.quarterly[0] - mldata.quarterly[1]) / (mldata.quarterly[1]*1.0) ));
+        pct_change_txt = "%u%".format(pct_change);
+        if (isNaN(pct_change)) {
+            pct_change_txt = 'big';
+        }
         if (pct_change > 25 && mldata.quarterly[0] > 5) {
-            txt += "<span style='color: #080'>- %s had a %u% increase in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change, mldata.quarterly[0], mldata.quarterly[1]);
+            txt += "<span style='color: #080'>- %s had a %s increase in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change_txt, mldata.quarterly[0], mldata.quarterly[1]);
         }
         else if (pct_change < -25  && mldata.quarterly[1] > 5) {
             pct_change = Math.abs(pct_change)
-            txt += "<span style='color: #800'>- %s had a %u% decrease in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change, mldata.quarterly[0], mldata.quarterly[1]);
+            txt += "<span style='color: #800'>- %s had a %s decrease in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change_txt, mldata.quarterly[0], mldata.quarterly[1]);
         }
     }
     

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864070&r1=1864069&r2=1864070&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Wed Jul 31 14:49:13 2019
@@ -1086,12 +1086,16 @@ function health_tips(data) {
         let a = ml.split('-', 2);
         ml = "%s@%s.apache.org".format(a[1], a[0]);
         let pct_change =Math.floor( 100 * ( (mldata.quarterly[0] - mldata.quarterly[1]) / (mldata.quarterly[1]*1.0) ));
+        pct_change_txt = "%u%".format(pct_change);
+        if (isNaN(pct_change)) {
+            pct_change_txt = 'big';
+        }
         if (pct_change > 25 && mldata.quarterly[0] > 5) {
-            txt += "<span style='color: #080'>- %s had a %u% increase in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change, mldata.quarterly[0], mldata.quarterly[1]);
+            txt += "<span style='color: #080'>- %s had a %s increase in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change_txt, mldata.quarterly[0], mldata.quarterly[1]);
         }
         else if (pct_change < -25  && mldata.quarterly[1] > 5) {
             pct_change = Math.abs(pct_change)
-            txt += "<span style='color: #800'>- %s had a %u% decrease in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change, mldata.quarterly[0], mldata.quarterly[1]);
+            txt += "<span style='color: #800'>- %s had a %s decrease in traffic in the past quarter (%u emails compared to %u)</span><br/>".format(ml, pct_change_txt, mldata.quarterly[0], mldata.quarterly[1]);
         }
     }