← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4547: Organisation unit distribution report, added a total column

 

------------------------------------------------------------
revno: 4547
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-08 17:47:47 +0200
message:
  Organisation unit distribution report, added a total column
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.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/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java	2011-02-28 02:42:12 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/orgunitdistribution/impl/DefaultOrgUnitDistributionService.java	2011-09-08 15:47:47 +0000
@@ -65,6 +65,7 @@
 
     private static final String TITLE_SEP = " - ";
     private static final String FIRST_COLUMN_TEXT = "Organisation unit";
+    private static final String HEADER_TOTAL = "Total";
     
     // -------------------------------------------------------------------------
     // Dependencies
@@ -134,6 +135,8 @@
             grid.addHeader( new GridHeader( group.getName(), false, false )  );
         }
         
+        grid.addHeader( new GridHeader( HEADER_TOTAL, false, false ) );
+        
         for ( OrganisationUnit unit : units )
         {            
             grid.addRow();
@@ -147,6 +150,8 @@
                 
                 grid.addValue( result != null ? result.size() : 0 );
             }
+            
+            grid.addValue( subTree != null ? subTree.size() : 0 );
         }
         
         return grid;

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java	2011-01-18 14:51:18 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java	2011-09-08 15:47:47 +0000
@@ -61,7 +61,7 @@
         
         Grid grid = distributionService.getOrganisationUnitDistribution( groupSet, unitA, false );
         assertNotNull( grid );
-        assertEquals( 3, grid.getWidth() );
+        assertEquals( 4, grid.getWidth() ); // Including total
         assertEquals( 3, grid.getHeight() ); // Including total
     }   
 }