← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7202: [mobile] enhance Person searching

 

------------------------------------------------------------
revno: 7202
committer: Long <thanhlongngo1988@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-06 11:31:43 +0700
message:
  [mobile] enhance Person searching
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.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-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2012-05-15 07:40:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2012-06-06 04:31:43 +0000
@@ -265,18 +265,18 @@
 
         if ( orgUnitId != 0 )
         {
+            Set<Patient> toRemoveList = new HashSet<Patient>();
             for ( Patient patient : patientByName )
             {
                 if ( patient.getOrganisationUnit().getId() != orgUnitId )
                 {
-                    patientByName.remove( patient );
+                    toRemoveList.add( patient );
                 }
             }
-        }
-        else
-        {
-            patients.addAll( patientByName );
-        }
+            patientByName.removeAll( toRemoveList );
+        }
+
+        patients.addAll( patientByName );
 
         return patients;
     }