← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19377: Analytics, code readability fix

 

------------------------------------------------------------
revno: 19377
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2015-06-13 14:11:43 +0200
message:
  Analytics, code readability fix
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-06-13 12:05:43 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-06-13 12:11:43 +0000
@@ -1315,15 +1315,9 @@
         {
             List<NameableObject> items = new ArrayList<>( dimension.getItems() );
 
-            boolean orgUnitHierarchy = hierarchyMeta && DimensionType.ORGANISATIONUNIT.equals( dimension.getDimensionType() );
-
-            // -----------------------------------------------------------------
-            // Insert UID and name into map
-            // -----------------------------------------------------------------
-
             for ( NameableObject object : items )
             {
-                if ( Period.class.isInstance( object ) && !calendar.isIso8601() )
+                if ( DimensionType.PERIOD.equals( dimension.getDimensionType() ) && !calendar.isIso8601() )
                 {
                     Period period = (Period) object;
                     DateTimeUnit dateTimeUnit = calendar.fromIso( period.getStartDate() );
@@ -1334,7 +1328,7 @@
                     map.put( object.getUid(), NameableObjectUtils.getDisplayProperty( object, displayProperty ) );
                 }
 
-                if ( orgUnitHierarchy )
+                if ( DimensionType.ORGANISATIONUNIT.equals( dimension.getDimensionType() ) && hierarchyMeta )
                 {
                     OrganisationUnit unit = (OrganisationUnit) object;