← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6792: (DV) Reporting rate bug fixed.

 

------------------------------------------------------------
revno: 6792
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-04-27 19:24:24 +0000
message:
  (DV) Reporting rate bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValues.vm


--
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-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-04-26 15:34:25 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-04-27 19:24:24 +0000
@@ -1206,7 +1206,7 @@
             }
         },
         variable: {
-			hasValue: function(str) {
+			isNotEmpty: function(str) {
 				return (str !== 0 && str !== '0' && str !== '');
 			}
 		},
@@ -1222,16 +1222,19 @@
                 values = [];
                 for (var i = 0; i < r.length; i++) {
 					var t = r[i][1];
-                    values.push({
+                    var v = {
 						value: r[i][0],
-						type: r[i][1] === 'in' ? DV.conf.finals.dimension.indicator.value :
-							  r[i][1] === 'de' ? DV.conf.finals.dimension.dataelement.value :
-							  r[i][1] === 'ds' ? DV.conf.finals.dimension.dataset.value : t,
+						type: t === 'in' ? DV.conf.finals.dimension.indicator.value :
+							  t === 'de' ? DV.conf.finals.dimension.dataelement.value :
+							  t === 'ds' ? DV.conf.finals.dimension.dataset.value : t,
 						dataid: r[i][2],
 						periodid: r[i][3],
-						organisationunitid: r[i][4],
-						organisationunitgroupid: r[i][5]
-					});
+						organisationunitid: r[i][4]
+					};
+					if (DV.util.variable.isNotEmpty(r[i][5])) {
+						v.organisationunitgroupid = r[i][5];
+					}
+					values.push(v);					
                 }
                 return values;
             }
@@ -1938,12 +1941,17 @@
 						return;
 					}
 					
-                    Ext.Array.each(DV.value.values, function(item) {
+                    Ext.Array.each(DV.value.values, function(item) {						
                         item[DV.conf.finals.dimension.data.value] = DV.util.string.getEncodedString(DV.store[item.type].available.storage[item.dataid].name);
                         item[DV.conf.finals.dimension.period.value] = DV.util.string.getEncodedString(DV.util.dimension.period.getNameById(item.periodid));
-                        item[DV.conf.finals.dimension.organisationunit.value] = DV.util.variable.hasValue(item.organisationunitgroupid) ?
-							DV.util.dimension.organisationunit.getGroupNameByGroupId(item.organisationunitgroupid) : DV.cmp.dimension.organisationunit.treepanel.findNameById(item.organisationunitid);
-                        item[DV.conf.finals.dimension.organisationunitgroup.value] = DV.util.variable.hasValue(item.organisationunitgroupid) ? DV.util.dimension.organisationunit.getGroupNameByGroupId(item.organisationunitgroupid) : null;
+                        item[DV.conf.finals.dimension.organisationunit.value] = DV.cmp.dimension.organisationunit.treepanel.findNameById(item.organisationunitid);
+                        
+                        if (item.organisationunitgroupid) {
+							var groupname = DV.util.dimension.organisationunit.getGroupNameByGroupId(item.organisationunitgroupid);
+							item[DV.conf.finals.dimension.organisationunit.value] = groupname;
+							item[DV.conf.finals.dimension.organisationunitgroup.value] = groupname;
+						}
+						
                         item.value = parseFloat(item.value);
                     });
                     
@@ -3196,7 +3204,7 @@
 														}
 													}
 												},
-												findNameById: function(id) {
+												findNameById: function(id) {					
 													var name = this.store.getNodeById(id) ? this.store.getNodeById(id).data.text : null;
 													if (!name) {
 														for (var k in this.storage) {

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValues.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValues.vm	2012-03-07 00:40:28 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminAggregatedValues.vm	2012-04-27 19:24:24 +0000
@@ -1,1 +1,1 @@
-#set($indicatorSize = $indicatorValues.size())#set($dataElementSize = $dataElementValues.size())#set($dataSetSize = $dataSetValues.size())[#if ($indicatorSize > 0)#foreach($obj in $indicatorValues)["$!{obj.value}","in","$!{obj.indicatorId}","$!{obj.periodId}","$!{obj.organisationUnitId}","$!{obj.organisationUnitGroupId}"]#if ($velocityCount < $indicatorSize),#end#end#end#if ($dataElementSize > 0)#if ($indicatorSize > 0),#end#foreach($obj in $dataElementValues)["$!{obj.value}","de","$!{obj.dataElementId}","$!{obj.periodId}","$!{obj.organisationUnitId}","$!{obj.organisationUnitGroupId}"]#if($velocityCount < $dataElementSize),#end#end#end#if ($dataSetSize > 0)#if ($indicatorSize > 0 || $dataElementSize > 0),#end#foreach($obj in $dataSetValues)["$!{obj.value}","ds","$!{obj.dataSetId}","$!{obj.periodId}","$!{obj.organisationUnitId}"]#if ($velocityCount < $dataSetSize),#end#end#end]
\ No newline at end of file
+#set($indicatorSize = $indicatorValues.size())#set($dataElementSize = $dataElementValues.size())#set($dataSetSize = $dataSetValues.size())[#if ($indicatorSize > 0)#foreach($obj in $indicatorValues)["$!{obj.value}","in","$!{obj.indicatorId}","$!{obj.periodId}","$!{obj.organisationUnitId}","$!{obj.organisationUnitGroupId}"]#if ($velocityCount < $indicatorSize),#end#end#end#if ($dataElementSize > 0)#if ($indicatorSize > 0),#end#foreach($obj in $dataElementValues)["$!{obj.value}","de","$!{obj.dataElementId}","$!{obj.periodId}","$!{obj.organisationUnitId}","$!{obj.organisationUnitGroupId}"]#if($velocityCount < $dataElementSize),#end#end#end#if ($dataSetSize > 0)#if ($indicatorSize > 0 || $dataElementSize > 0),#end#foreach($obj in $dataSetValues)["$!{obj.value}","ds","$!{obj.dataSetId}","$!{obj.periodId}","$!{obj.organisationUnitId}","$!{obj.organisationUnitGroupId}"]#if ($velocityCount < $dataSetSize),#end#end#end]
\ No newline at end of file