← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2782: Fixed issue with completeness, not showing orgunits if the relevant data set is not assigned to i...

 

------------------------------------------------------------
revno: 2782
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-01-30 21:55:40 +0100
message:
  Fixed issue with completeness, not showing orgunits if the relevant data set is not assigned to it or its children
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java


--
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-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2011-01-30 20:55:40 +0000
@@ -243,16 +243,20 @@
         {
             final DataSetCompletenessResult result = new DataSetCompletenessResult();
             
-            result.setName( dataSet.getName() );
-            result.setRegistrations( getRegistrations( dataSet, children, period ) );
-            result.setRegistrationsOnTime( deadline != null ? getRegistrationsOnTime( dataSet, children, period, deadline ) : 0 );
             result.setSources( getSources( dataSet, children ) );
             
-            result.setDataSetId( dataSet.getId() );
-            result.setPeriodId( periodId );
-            result.setOrganisationUnitId( organisationUnitId );
-            
-            results.add( result );
+            if ( result.getSources() > 0 )
+            {
+                result.setName( dataSet.getName() );
+                result.setRegistrations( getRegistrations( dataSet, children, period ) );
+                result.setRegistrationsOnTime( deadline != null ? getRegistrationsOnTime( dataSet, children, period, deadline ) : 0 );
+                            
+                result.setDataSetId( dataSet.getId() );
+                result.setPeriodId( periodId );
+                result.setOrganisationUnitId( organisationUnitId );
+                
+                results.add( result );
+            }
         }
         
         return results;
@@ -280,16 +284,20 @@
             
             final DataSetCompletenessResult result = new DataSetCompletenessResult();
             
-            result.setName( unit.getName() );
-            result.setRegistrations( getRegistrations( dataSet, children, period ) );
-            result.setRegistrationsOnTime( deadline != null ? getRegistrationsOnTime( dataSet, children, period, deadline ) : 0 );
             result.setSources( getSources( dataSet, children ) );
             
-            result.setDataSetId( dataSetId );
-            result.setPeriodId( periodId );
-            result.setOrganisationUnitId( unit.getId() );
-            
-            results.add( result );
+            if ( result.getSources() > 0 )
+            {
+                result.setName( unit.getName() );
+                result.setRegistrations( getRegistrations( dataSet, children, period ) );
+                result.setRegistrationsOnTime( deadline != null ? getRegistrationsOnTime( dataSet, children, period, deadline ) : 0 );
+                            
+                result.setDataSetId( dataSetId );
+                result.setPeriodId( periodId );
+                result.setOrganisationUnitId( unit.getId() );
+                
+                results.add( result );
+            }
         }
         
         return results;