← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14916: Minor

 

------------------------------------------------------------
revno: 14916
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-04-20 18:02:32 +0200
message:
  Minor
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataapproval/action/GetCategoryOptionGroupsAction.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-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataapproval/action/GetCategoryOptionGroupsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataapproval/action/GetCategoryOptionGroupsAction.java	2014-04-20 15:54:16 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataapproval/action/GetCategoryOptionGroupsAction.java	2014-04-20 16:02:32 +0000
@@ -132,17 +132,22 @@
      */
     private void addNoneGroupIfNoGroupSet( List<DataApprovalLevel> approvalLevels, List<CategoryOptionGroup> categoryOptionGroups )
     {
+        boolean hasGroupSet = false;
         boolean hasNoGroupSet = false;
         
         for ( DataApprovalLevel level : approvalLevels )
         {
-            if ( level != null && !level.hasCategoryOptionGroupSet() )
+            if ( level.hasCategoryOptionGroupSet() )
+            {
+                hasGroupSet = true;
+            }
+            else
             {
                 hasNoGroupSet = true;
             }
         }
         
-        if ( !approvalLevels.isEmpty() && hasNoGroupSet )
+        if ( hasGroupSet && hasNoGroupSet )
         {
             CategoryOptionGroup cog = new CategoryOptionGroup( "[ " + i18n.getString( "none") + " ]" );
             categoryOptionGroups.add( 0, cog );