From 06116dd5f166ec2fff0531d21d6a291c9018703c Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Mon, 17 Jun 2013 16:00:17 -0400
Subject: [PATCH] Minor tweaks to SalesForce user service

---
 src/main/java/com/gitblit/wicket/pages/DashboardPage.java |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/gitblit/wicket/pages/DashboardPage.java b/src/main/java/com/gitblit/wicket/pages/DashboardPage.java
index 5d83839..6c328b1 100644
--- a/src/main/java/com/gitblit/wicket/pages/DashboardPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/DashboardPage.java
@@ -99,6 +99,7 @@
 			add(new Label("active").setVisible(false));
 			add(new Label("starred").setVisible(false));
 			add(new Label("owned").setVisible(false));
+			add(new Label("feedheader").setVisible(false));
 			return;
 		}
 
@@ -201,8 +202,9 @@
 				}
 			}
 
-			GoogleCharts charts = createCharts(pushes, authorExclusions);
-			add(new HeaderContributor(charts));
+			addCharts(pushes, authorExclusions, daysBack);
+		} else {
+			add(new Label("feedheader").setVisible(false));
 		}
 		
 		// active repository list
@@ -371,14 +373,16 @@
 	 * and the active authors pie chart
 	 * 
 	 * @param recentPushes
-	 * @return
+	 * @param authorExclusions
+	 * @param daysBack
 	 */
-	private GoogleCharts createCharts(List<PushLogEntry> recentPushes, Set<String> authorExclusions) {
+	private void addCharts(List<PushLogEntry> recentPushes, Set<String> authorExclusions, int daysBack) {
 		// activity metrics
 		Map<String, Metric> repositoryMetrics = new HashMap<String, Metric>();
 		Map<String, Metric> authorMetrics = new HashMap<String, Metric>();
 
 		// aggregate repository and author metrics
+		int totalCommits = 0;
 		for (PushLogEntry push : recentPushes) {
 
 			// aggregate repository metrics
@@ -389,6 +393,7 @@
 			repositoryMetrics.get(repository).count += 1;
 			
 			for (RepositoryCommit commit : push.getCommits()) {
+				totalCommits++;
 				String author = StringUtils.removeNewlines(commit.getAuthorIdent().getName());
 				String authorName = author.toLowerCase();
 				String authorEmail = StringUtils.removeNewlines(commit.getAuthorIdent().getEmailAddress()).toLowerCase();
@@ -400,6 +405,9 @@
 				}
 			}
 		}
+		
+		add(new Label("feedheader", MessageFormat.format(getString("gb.recentActivityStats"),
+				daysBack, totalCommits, authorMetrics.size())));
 
 		// build google charts
 		GoogleCharts charts = new GoogleCharts();
@@ -422,7 +430,7 @@
 		chart.setShowLegend(false);
 		charts.addChart(chart);
 
-		return charts;
+		add(new HeaderContributor(charts));
 	}
 	
 	class RepoListItem implements Serializable {

--
Gitblit v1.9.1