← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20211: Org unit query, test fix

 

------------------------------------------------------------
revno: 20211
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 14:59:41 +0200
message:
  Org unit query, test fix
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.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-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java	2015-09-17 12:25:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java	2015-09-17 12:59:41 +0000
@@ -230,7 +230,7 @@
         {
             for ( Integer level : params.getLevels() )
             {
-                query.setInteger( "levelPathLength" + level, level );
+                query.setInteger( "levelPathLength" + level, params.getLevelPathLength( level ) );
             }
         }
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java	2015-09-17 12:25:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java	2015-09-17 12:59:41 +0000
@@ -145,19 +145,19 @@
 
         ous = orgUnitStore.getOrganisationUnits( params );
 
-        assertEquals( 4, ous.size() );
-        assertTrue( ous.containsAll( Sets.newHashSet( ouB, ouC, ouD, ouE ) ) );
+        assertEquals( 6, ous.size() );
+        assertTrue( ous.containsAll( Sets.newHashSet( ouB, ouC, ouD, ouE, ouF, ouG ) ) );
 
         // Levels and groups
         
         params = new OrganisationUnitQueryParams();
-        params.setLevels( Sets.newHashSet( 4 ) );
+        params.setLevels( Sets.newHashSet( 3 ) );
         params.setGroups( Sets.newHashSet( ogA ) );
 
         ous = orgUnitStore.getOrganisationUnits( params );
 
-        assertEquals( 1, ous.size() );
-        assertTrue( ous.containsAll( Sets.newHashSet( ouF ) ) );
+        assertEquals( 2, ous.size() );
+        assertTrue( ous.containsAll( Sets.newHashSet( ouD, ouF ) ) );
 
         // Parents and groups