← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4730: Visit plans list is duplicated

 

------------------------------------------------------------
revno: 4730
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-28 14:00:14 +0700
message:
  Visit plans list is duplicated
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/SearchVisitPlanAction.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/activityplan/DefaultActivityPlanService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2011-05-23 06:10:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java	2011-09-28 07:00:14 +0000
@@ -371,7 +371,6 @@
 
         for ( ProgramInstance programInstance : programInstances )
         {
-
             Program program = programInstance.getProgram();
 
             ProgramStage nextStage = program.getProgramStageByStage( visitsByProgramInstances.get( programInstance

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java	2011-05-23 06:10:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/jdbc/JdbcActivityPlanStore.java	2011-09-28 07:00:14 +0000
@@ -138,8 +138,7 @@
                                 "INNER JOIN program_organisationunits po1 " +
                                     "ON po1.programid=pi1.programid " +
                                 "WHERE pi1.completed = FALSE  " +
-                                    "AND po1.organisationunitid = " + orgunitId + " AND psi1.completed = FALSE ) " +
-                         "ORDER BY ps.stageinprogram";
+                                    "AND po1.organisationunitid = " + orgunitId + " AND psi1.completed = FALSE ) ";
 
             ResultSet resultSet = statement.executeQuery( sql );
             if(resultSet.next())

=== 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	2011-08-01 18:58:07 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2011-09-28 07:00:14 +0000
@@ -330,7 +330,7 @@
     @Override
     public Collection<Patient> sortPatientsByAttribute( Collection<Patient> patients, PatientAttribute patientAttribute )
     {
-        List<PatientAttributeValue> patientsSortedByAttribute = new ArrayList<PatientAttributeValue>();
+//        List<PatientAttributeValue> patientsSortedByAttribute = new ArrayList<PatientAttributeValue>();
 
         Collection<Patient> sortedPatients = new ArrayList<Patient>();
 
@@ -341,14 +341,15 @@
 
         Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
             .getPatientAttributeValues( patients );
-
+        
         if ( patientAttributeValues != null )
-        {        
+        {
             for ( PatientAttributeValue patientAttributeValue : patientAttributeValues )
             {
                 if ( patientAttribute == patientAttributeValue.getPatientAttribute() )
                 {
-                    patientsSortedByAttribute.add(  patientAttributeValue );
+                    sortedPatients.add( patientAttributeValue.getPatient() );
+                    patients.remove( patientAttributeValue.getPatient() );
                 }
             }
         }
@@ -357,16 +358,9 @@
         // Make sure all patients are in the sorted list - because all
         // patients might not have the sorting attribute/value
         // ---------------------------------------------------------------------
-        
-        for( PatientAttributeValue patientAttributeValue : patientsSortedByAttribute )
-        {
-            sortedPatients.add( patientAttributeValue.getPatient() );
-        }
-        
-        patients.removeAll( patientsSortedByAttribute );
-        
+
         sortedPatients.addAll( patients );
-
+        
         return sortedPatients;
     }
 
@@ -469,7 +463,7 @@
     {
         return patientStore.countGetPatientsByOrgUnitProgram( organisationUnit, program );
     }
-    
+
     @Override
     public Object getObjectValue( String property, String value, I18nFormat format )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/SearchVisitPlanAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/SearchVisitPlanAction.java	2011-05-23 06:10:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/SearchVisitPlanAction.java	2011-09-28 07:00:14 +0000
@@ -213,10 +213,7 @@
             if ( sortingAttributeId != null )
             {
                 sortingAttribute = patientAttributeService.getPatientAttribute( sortingAttributeId );
-            }
-
-            if ( sortingAttribute != null )
-            {
+          
                 sortedPatients = patientService.sortPatientsByAttribute( patientsToBeVisited, sortingAttribute );
             }
             else