Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ES: make default stats period configurable

  • Loading branch information...
commit 3ecc3b52deff1ba7553d795ad497ec8fa46eaf35 1 parent 5ab2ef1
@helix84 authored
View
9 ...in/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/ElasticSearchStatsViewer.java
@@ -18,6 +18,7 @@
import org.dspace.content.*;
import org.dspace.content.Item;
import org.dspace.core.Constants;
+import org.dspace.core.ConfigurationManager;
import org.dspace.statistics.DataTermsFacet;
import org.dspace.statistics.ElasticSearchLogger;
import org.elasticsearch.action.search.SearchResponse;
@@ -131,9 +132,11 @@ public void addBody(Body body) throws WingException, SQLException {
//Homepage will show the last 5 years worth of Data, and no form generator.
Calendar cal = Calendar.getInstance();
dateEnd = cal.getTime();
-
+
+ int years = ConfigurationManager.getIntProperty("elastic-search-statistics", "recent.years", 5);
+
//Roll back to Jan 1 0:00.000 five years ago.
- cal.roll(Calendar.YEAR, -5);
+ cal.roll(Calendar.YEAR, -years);
cal.set(Calendar.MONTH, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY,0);
@@ -143,7 +146,7 @@ public void addBody(Body body) throws WingException, SQLException {
dateStart = cal.getTime();
division.addHidden("reportDepth").setValue("summary");
- String dateRange = "Last Five Years";
+ String dateRange = "Last " + years + " Years";
division.addPara("Showing Data ( " + dateRange + " )");
division.addHidden("timeRangeString").setValue("Data Range: " + dateRange);
if(dateStart != null) {
View
3  dspace/config/modules/elastic-search-statistics.cfg
@@ -6,3 +6,6 @@
## Elastic Search can connect via TransportClient, for external ES service.
#address = 127.0.0.1
#statistics.elasticsearch.port = 9300
+
+## Number of recent years to show on the homepage of the statistics portal
+#recent.years = 5
Please sign in to comment.
Something went wrong with that request. Please try again.