← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18980: Javadoc

 

------------------------------------------------------------
revno: 18980
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-04-22 13:19:40 +0200
message:
  Javadoc
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.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-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2015-04-17 14:36:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java	2015-04-22 11:19:40 +0000
@@ -110,7 +110,8 @@
     DataApprovalLevel getLowestDataApprovalLevel( OrganisationUnit orgUnit, DataElementCategoryOptionCombo attributeOptionCombo );
 
     /**
-     * Gets a list of all data approval levels.
+     * Gets a list of all data approval levels, ordered by level in ascending order,
+     * i.e. from 1 to n.
      *
      * @return list of all data approval levels, ordered from 1 to n.
      */

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelStore.java	2015-04-22 11:19:40 +0000
@@ -47,7 +47,8 @@
     // -------------------------------------------------------------------------
 
     /**
-     * Gets a list of all data approval levels.
+     * Gets a list of all data approval levels, ordered by level in ascending order,
+     * i.e. from 1 to n.
      *
      * @return List of all data approval levels, ordered from 1 to n.
      */

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2015-04-22 10:39:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2015-04-22 11:19:40 +0000
@@ -682,8 +682,10 @@
     {
         DataApprovalLevel userLevel = getUserApprovalLevel( orgUnit, user, approvalLevels );
 
+        int totalLevels = approvalLevels.size();
+        
         return userLevel == null ? 0 : 
-            userLevel.getLevel() == approvalLevels.size() ? APPROVAL_LEVEL_UNAPPROVED :
+            userLevel.getLevel() == totalLevels ? APPROVAL_LEVEL_UNAPPROVED :
             userLevel.getLevel() + 1;
     }
 
@@ -713,13 +715,13 @@
      */
     private DataApprovalLevel getUserApprovalLevel( OrganisationUnit orgUnit, User user, List<DataApprovalLevel> approvalLevels )
     {
-        int orgUnitLevel = organisationUnitService.getLevelOfOrganisationUnit( orgUnit );
+        int userOrgUnitLevel = organisationUnitService.getLevelOfOrganisationUnit( orgUnit );
 
         DataApprovalLevel userLevel = null;
 
         for ( DataApprovalLevel level : approvalLevels )
         {
-            if ( level.getOrgUnitLevel() >= orgUnitLevel &&
+            if ( level.getOrgUnitLevel() >= userOrgUnitLevel &&
                 securityService.canRead( level ) &&
                 canReadCOGS( user, level.getCategoryOptionGroupSet() ) )
             {