dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27877
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13889: PT, new option 'aggregation type' (by data element, count and sum).
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13889 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-29 12:38:48 +0100
message:
PT, new option 'aggregation type' (by data element, count and sum).
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml
dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2014-01-07 19:21:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2014-01-29 11:35:59 +0000
@@ -89,6 +89,10 @@
public static final String TOTAL_COLUMN_NAME = "total";
public static final String TOTAL_COLUMN_PRETTY_NAME = "Total";
+
+ public static final String AGGREGATION_TYPE_DEFAULT = "default";
+ public static final String AGGREGATION_TYPE_COUNT = "count";
+ public static final String AGGREGATION_TYPE_SUM = "sum";
public static final String DISPLAY_DENSITY_COMFORTABLE = "comfortable";
public static final String DISPLAY_DENSITY_NORMAL = "normal";
@@ -204,6 +208,11 @@
*/
private boolean showHierarchy;
+ /**
+ * Indicates the aggregation type.
+ */
+ private String aggregationType;
+
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
@@ -924,6 +933,19 @@
@JsonProperty
@JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+ public String getAggregationType()
+ {
+ return aggregationType;
+ }
+
+ public void setAggregationType( String aggregationType )
+ {
+ this.aggregationType = aggregationType;
+ }
+
+ @JsonProperty
+ @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
public String getDigitGroupSeparator()
{
return digitGroupSeparator;
@@ -1052,6 +1074,7 @@
totals = reportTable.isTotals();
subtotals = reportTable.isSubtotals();
hideEmptyRows = reportTable.isHideEmptyRows();
+ aggregationType = reportTable.getAggregationType();
digitGroupSeparator = reportTable.getDigitGroupSeparator();
displayDensity = reportTable.getDisplayDensity();
fontSize = reportTable.getFontSize();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-01-23 14:09:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-01-29 11:02:07 +0000
@@ -455,6 +455,7 @@
executeSql( "update reporttable set sortorder = 0 where sortorder is null" );
executeSql( "update reporttable set toplimit = 0 where toplimit is null" );
executeSql( "update reporttable set showhierarchy = false where showhierarchy is null" );
+ executeSql( "update reporttable set aggregationtype = 'default' where aggregationtype is null" );
executeSql( "update chart set reportingmonth = false where reportingmonth is null" );
executeSql( "update chart set reportingbimonth = false where reportingbimonth is null" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2013-10-15 16:53:50 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2014-01-29 11:02:07 +0000
@@ -149,6 +149,8 @@
<property name="hideEmptyRows" />
+ <property name="aggregationType" />
+
<property name="digitGroupSeparator" />
<property name="displayDensity" />
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-12-04 12:50:08 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2014-01-29 11:02:07 +0000
@@ -144,4 +144,9 @@
financial_oct=Financial October
financial_july=Financial July
financial_april=Financial April
-plugin_config=Plugin config
\ No newline at end of file
+plugin_config=Plugin config
+default_=Default
+aggregation_type=Aggregation type
+count=Count
+sum=Sum
+by_data_element=By data element
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json 2013-12-04 12:53:04 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/i18n.json 2014-01-29 11:02:07 +0000
@@ -145,5 +145,10 @@
"financial_oct",
"financial_july",
"financial_april",
-"plugin_config"
+"plugin_config",
+"default_",
+"aggregation_type",
+"count",
+"sum",
+"by_data_element"
]
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-01-24 02:09:28 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-01-29 11:35:59 +0000
@@ -382,6 +382,7 @@
var showTotals,
showSubTotals,
hideEmptyRows,
+ aggregationType,
showHierarchy,
digitGroupSeparator,
displayDensity,
@@ -414,6 +415,27 @@
style: 'margin-bottom:4px'
});
+ aggregationType = Ext.create('Ext.form.field.ComboBox', {
+ cls: 'ns-combo',
+ style: 'margin-bottom:3px',
+ width: comboboxWidth,
+ labelWidth: 130,
+ fieldLabel: NS.i18n.aggregation_type,
+ labelStyle: 'color:#333',
+ queryMode: 'local',
+ valueField: 'id',
+ editable: false,
+ value: 'default',
+ store: Ext.create('Ext.data.Store', {
+ fields: ['id', 'text'],
+ data: [
+ {id: 'default', text: NS.i18n.by_data_element},
+ {id: 'count', text: NS.i18n.count},
+ {id: 'sum', text: NS.i18n.sum}
+ ]
+ })
+ });
+
showHierarchy = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_hierarchy,
style: 'margin-bottom:4px'
@@ -571,7 +593,8 @@
items: [
showTotals,
showSubTotals,
- hideEmptyRows
+ hideEmptyRows,
+ aggregationType
]
};
@@ -621,6 +644,7 @@
showTotals: showTotals.getValue(),
showSubTotals: showSubTotals.getValue(),
hideEmptyRows: hideEmptyRows.getValue(),
+ aggregationType: aggregationType.getValue(),
showHierarchy: showHierarchy.getValue(),
displayDensity: displayDensity.getValue(),
fontSize: fontSize.getValue(),
@@ -639,6 +663,7 @@
showTotals.setValue(Ext.isBoolean(layout.showTotals) ? layout.showTotals : true);
showSubTotals.setValue(Ext.isBoolean(layout.showSubTotals) ? layout.showSubTotals : true);
hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false);
+ aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default');
showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false);
displayDensity.setValue(Ext.isString(layout.displayDensity) ? layout.displayDensity : 'normal');
fontSize.setValue(Ext.isString(layout.fontSize) ? layout.fontSize : 'normal');
@@ -733,6 +758,7 @@
w.showTotals = showTotals;
w.showSubTotals = showSubTotals;
w.hideEmptyRows = hideEmptyRows;
+ w.aggregationType = aggregationType;
w.showHierarchy = showHierarchy;
w.displayDensity = displayDensity;
w.fontSize = fontSize;
@@ -825,6 +851,8 @@
delete favorite.parentGraphMap;
+ delete favorite.id;
+
// Replace operand id characters
for (var i = 0; i < dimensions.length; i++) {
if (dimensions[i].dimension === ns.core.conf.finals.dimension.operand.objectName) {
@@ -1112,7 +1140,7 @@
if (favorite) {
favorite.name = record.data.name;
-
+console.log(favorite);
if (confirm(message)) {
Ext.Ajax.request({
url: ns.core.init.contextPath + '/api/reportTables/' + record.data.id,
@@ -2269,7 +2297,7 @@
failure: function(r) {
web.mask.hide(ns.app.centerRegion);
- if (r.status === 413 || r.status === 414) {
+ if (Ext.Array.contains([413, 414], parseInt(r.status))) {
web.analytics.validateUrl(init.contextPath + '/api/analytics.json' + paramString);
}
else {
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2014-01-24 02:09:28 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2014-01-29 11:02:07 +0000
@@ -271,6 +271,8 @@
// hideEmptyRows: boolean (false)
+ // aggregationType: string ('default') - 'default', 'count', 'sum'
+
// showHierarchy: boolean (false)
// displayDensity: string ('normal') - 'compact', 'normal', 'comfortable'
@@ -433,6 +435,7 @@
layout.showTotals = Ext.isBoolean(config.totals) ? config.totals : (Ext.isBoolean(config.showTotals) ? config.showTotals : true);
layout.showSubTotals = Ext.isBoolean(config.subtotals) ? config.subtotals : (Ext.isBoolean(config.showSubTotals) ? config.showSubTotals : true);
layout.hideEmptyRows = Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : false;
+ layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'default';
layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false;
@@ -1749,7 +1752,11 @@
addCategoryDimension = false,
map = xLayout.dimensionNameItemsMap,
dx = dimConf.indicator.dimensionName,
- co = dimConf.category.dimensionName;
+ co = dimConf.category.dimensionName,
+ aggTypes = {
+ 'count': 'COUNT',
+ 'sum': 'SUM'
+ };
for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
dimName = axisDimensionNames[i];
@@ -1796,6 +1803,10 @@
paramString += '&hierarchyMeta=true';
}
+ if (aggTypes.hasOwnProperty(xLayout.aggregationType)) {
+ paramString += '&aggregationType=' + aggTypes[xLayout.aggregationType];
+ }
+
return paramString;
};