← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19034: Bulk approval, fixed bug, not possible to bulk approve for data sets with default category combo....

 

------------------------------------------------------------
revno: 19034
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-04-27 21:57:00 +0200
message:
  Bulk approval, fixed bug, not possible to bulk approve for data sets with default category combo. Minor performance improvement by moving db calls one level out in loops.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.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-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java	2015-04-27 19:57:00 +0000
@@ -707,15 +707,15 @@
 
         for ( DataSet dataSet : dataSets )
         {
-            Set<DataElementCategoryOptionCombo> dataSetOptionCombos = dataSet.hasCategoryCombo() ? dataSet.getCategoryCombo().getOptionCombos() : null;
+            Set<DataElementCategoryOptionCombo> dataSetOptionCombos = dataSet.getCategoryCombo() != null ? dataSet.getCategoryCombo().getOptionCombos() : null;
 
-            for ( Period period : periods )
+            for ( Approval approval : approvals.getApprovals() )
             {
-                for ( Approval approval : approvals.getApprovals() )
+                OrganisationUnit unit = organisationUnitService.getOrganisationUnit( approval.getOu() );
+                DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( approval.getAoc() );
+                
+                for ( Period period : periods )
                 {
-                    OrganisationUnit unit = organisationUnitService.getOrganisationUnit( approval.getOu() );
-                    DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( approval.getAoc() );
-
                     if ( dataSetOptionCombos != null && dataSetOptionCombos.contains( optionCombo ) )
                     {
                         DataApproval dataApproval = new DataApproval( null, dataSet, period, unit, optionCombo, false, date, user );