community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1663793 - in /comdev/reporter.apache.org/site: getjson.py render.js
Date Tue, 03 Mar 2015 21:14:41 GMT
Author: humbedooh
Date: Tue Mar  3 21:14:41 2015
New Revision: 1663793

URL: http://svn.apache.org/r1663793
Log:
fix typo and use extended mail stats
also be better at reflowing lines

Modified:
    comdev/reporter.apache.org/site/getjson.py
    comdev/reporter.apache.org/site/render.js

Modified: comdev/reporter.apache.org/site/getjson.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/getjson.py?rev=1663793&r1=1663792&r2=1663793&view=diff
==============================================================================
--- comdev/reporter.apache.org/site/getjson.py (original)
+++ comdev/reporter.apache.org/site/getjson.py Tue Mar  3 21:14:41 2015
@@ -15,7 +15,7 @@ pmap = {
 }
 
 jirapass = ""
-with open("/var/wwww/reporter.apache.org/data/jirapass.txt", "r") as f:
+with open("/var/www/reporter.apache.org/data/jirapass.txt", "r") as f:
     jirapass = f.read().strip()
     f.close()
     
@@ -137,7 +137,7 @@ if m:
                 mlstats[tlp] = mlstats[tlp] if tlp in mlstats else {}
                 mlstats[tlp][entry] = ml[entry]
     emails = {}
-    with open("/var/www/reporter.apache.org/data/maildata.json", "r") as f:
+    with open("/var/www/reporter.apache.org/data/maildata_extended.json", "r") as f:
         mld = json.loads(f.read())
         f.close()
         for entry in mld:

Modified: comdev/reporter.apache.org/site/render.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/render.js?rev=1663793&r1=1663792&r2=1663793&view=diff
==============================================================================
--- comdev/reporter.apache.org/site/render.js (original)
+++ comdev/reporter.apache.org/site/render.js Tue Mar  3 21:14:41 2015
@@ -159,7 +159,7 @@ function addLine(pmc, line) {
 		for (i in words) {
 			len += words[i].length + (i == words.length-1 ? 0 : 1)
 			if (len >= 80) {
-				out += "\n  "
+				out += "\n   "
 				len = words[i].length + (i == words.length-1 ? 0 : 1)
 			}
 			out += words[i] + " "
@@ -371,16 +371,18 @@ function renderFrontPage(json) {
 	    if (ml != prev && ml.search("infra") < 0 && json.mail[pmc] &&
json.mail[pmc][ml]) {
 			f++;
 			prev = ml
-			var x = renderChart(json.mail[pmc], ml, obj)
-			var total = x[0]
-			var diff = x[1]
-			var div = x[2]
 			var d = ml.split(".org-");
 			var mlname = d[1] + "@" + d[0] + ".org"
 			var lookup = d[0].split(/\./)[0] + "-" + d[1]
+			
+			var x = renderChart(json.mail[pmc], ml, obj, json.delivery[pmc][lookup] ? json.delivery[pmc][lookup].weekly
: {})
+			var total = x[0]
+			var diff = x[1]
+			var div = x[2]
+			
 			add = ""
 			if (json.delivery[pmc][lookup]) {
-				add = ":\n    " + json.delivery[pmc][lookup][0] + " emails sent to list (" + json.delivery[pmc][lookup][1]
+ " in previous quarter)";
+				add = ":\n    " + json.delivery[pmc][lookup].quarterly[0] + " emails sent to list ("
+ json.delivery[pmc][lookup].quarterly[1] + " in previous quarter)";
 			}
 			var text = "Currently: " + total + " subscribers <font color='green'>(up " + diff
+ " in the last 3 months)</font>"
 			if (diff < 0) {
@@ -395,7 +397,7 @@ function renderFrontPage(json) {
 			}
 			
 			if (json.delivery[pmc][lookup]) {
-				text += " (" + json.delivery[pmc][lookup][0] + " emails sent in the past 3 months, "
+ json.delivery[pmc][lookup][1] + " in the previous cycle)"
+				text += " (" + json.delivery[pmc][lookup].quarterly[0] + " emails sent in the past 3
months, " + json.delivery[pmc][lookup].quarterly[1] + " in the previous cycle)"
 			}
 			
 			var p = document.createElement('li');
@@ -418,16 +420,17 @@ function renderFrontPage(json) {
 			f++;
 			if (ml != prev && ml.search("infra") < 0) {
 			prev = ml
-			var x = renderChart(json.mail[pmc], ml, obj)
-			var total = x[0]
-			var diff = x[1]
-			var div = x[2]
 			var d = ml.split(".org-");
 			var mlname = d[1] + "@" + d[0] + ".org"
 			var lookup = d[0].split(/\./)[0] + "-" + d[1]
+			var x = renderChart(json.mail[pmc], ml, obj, json.delivery[pmc][lookup] ? json.delivery[pmc][lookup].weekly
: {})
+			var total = x[0]
+			var diff = x[1]
+			var div = x[2]
+			
 			add = ""
 			if (json.delivery[pmc][lookup]) {
-				add = ":\n    " + json.delivery[pmc][lookup][0] + " emails sent to list (" + json.delivery[pmc][lookup][1]
+ " in previous quarter)";
+				add = ":\n    " + json.delivery[pmc][lookup].quarterly[0] + " emails sent to list ("
+ json.delivery[pmc][lookup].quarterly[1] + " in previous quarter)";
 			}
 			var text = "Currently: " + total + " subscribers <font color='green'>(up " + diff
+ " in the last 3 months)</font>"
 			if (diff < 0) {
@@ -442,7 +445,7 @@ function renderFrontPage(json) {
 			}
 			
 			if (json.delivery[pmc][lookup]) {
-				text += " (" + json.delivery[pmc][lookup][0] + " emails sent in the past 3 months, "
+ json.delivery[pmc][lookup][1] + " in the previous cycle)"
+				text += " (" + json.delivery[pmc][lookup].quarterly[0] + " emails sent in the past 3
months, " + json.delivery[pmc][lookup].quarterly[1] + " in the previous cycle)"
 			}
 			
 			var p = document.createElement('li');
@@ -504,14 +507,16 @@ function renderJIRA(pmc, project) {
 }
 
 
-function renderChart(json, name, container) {
+function renderChart(json, name, container, delivery) {
     
     var chartDiv = document.createElement('div')
     chartDiv.setAttribute("id", name + "_chart")
     var dates = []
+	var noweekly = 0;
     for (date in json[name]) {
 	dates.push(date)
     }
+	for (date in delivery) noweekly++;
     var d = name.split(".org-");
     var mlname = d[1] + "@" + d[0] + ".org"
     dates.sort();
@@ -521,38 +526,72 @@ function renderChart(json, name, contain
     
     var dp = new Date();
     dp.setMonth(dp.getMonth() - 3);
+	
+	var odp = new Date();
+    odp.setMonth(odp.getMonth() - 6);
+	if (dp.getMonth() - 6 < 0) {
+		odp.setYear(odp.getYear() - 1)
+	}
 
     difference = 0
     for (i in dates) {
-	var date = dates[i];
-	var dateString = new Date(parseInt(date)*1000);
-	if (dateString > dp) {
-	    difference += json[name][date]
-	}
-	cu = cu + json[name][date];
-	if (cu > 0) {
-	    hitFirst = true
-	}
-	if (cu > 0 || hitFirst) {
-	    narr.push([dateString, cu])
-	}
-	
+		var date = dates[i];
+		var dateString = new Date(parseInt(date)*1000);
+		if (dateString > dp) {
+			difference += json[name][date]
+		}
+		cu = cu + json[name][date];
+		if (cu > 0) {
+			hitFirst = true
+		}
+		if ((cu > 0 || hitFirst) && dateString >= odp) {
+			if (noweekly > 0) {
+				narr.push([dateString, cu, delivery[date] ? delivery[date] : 0])
+			} else {
+				narr.push([dateString, cu])
+			}
+		}
+
     }
     
     var data = new google.visualization.DataTable();
         data.addColumn('date', 'Date');
         data.addColumn('number', "List members");
+		if (noweekly > 0) {
+			data.addColumn('number', "Emails sent per week");
+		}
+		
         data.addRows(narr);
 
     
     var options = {
-      title: 'Mailing list subscribers for ' + mlname,
-      height: 240,
-      width: 800,
-      backgroundColor: 'transparent'
-    };
+		title: 'Mailing list stats for ' + mlname,
+		backgroundColor: 'transparent',
+		width: 900,
+		height: 260,
+		legend: {
+			position: 'none',
+			maxLines: 3
+		},
+		vAxis: {
+			format: "#"
+		},
+		vAxes: (noweekly > 0) ? [
+		
+		{title: 'Emails per week', titleTextStyle: {color: '#DD0000'}},
+		{title: 'Subscribers', titleTextStyle: {color: '#0000DD'}},
+		] : [
+		{title: 'Subscribers', titleTextStyle: {color: '#0000DD'}},
+		],
+		series: {
+		  0: {type: "line", pointSize:4, lineWidth: 2, targetAxisIndex: (noweekly > 0) ? 1 :
null},
+		  1: {type: "bars", targetAxisIndex: (noweekly > 0) ? 0 : [0,1]}
+		  },
+		  seriesType: "bars",
+		tooltip: {isHtml: true},
+	  };
 
-    var chart = new google.visualization.LineChart(chartDiv);
+    var chart = new google.visualization.ComboChart(chartDiv);
     
     chart.draw(data, options);
     return [cu, difference, chartDiv];
@@ -581,7 +620,7 @@ function renderReleaseChart(releases, na
     var data = new google.visualization.DataTable();
 	
 	data.addColumn('datetime', 'Date');
-	data.addColumn('number', 'Major Version')
+	data.addColumn('number', 'Version')
 	data.addColumn('string', 'tooltip');
 	data.setColumnProperty(2, 'role', 'tooltip');
 	



Mime
View raw message