← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9424: Minor fix.

 

------------------------------------------------------------
revno: 9424
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-01-03 14:07:04 +0700
message:
  Minor fix.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.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/scheduling/CaseAggregateConditionTask.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.java	2013-01-03 06:54:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/scheduling/CaseAggregateConditionTask.java	2013-01-03 07:07:04 +0000
@@ -27,6 +27,7 @@
 
 package org.hisp.dhis.patient.scheduling;
 
+import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
 
@@ -188,12 +189,14 @@
 
     private Period getPeriod( String periodTypeName )
     {
-        Date date = new Date();
+        Calendar today = Calendar.getInstance();  
+        
+        today.add(Calendar.DATE, -1);  
 
         CalendarPeriodType periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodTypeName );
 
-        Period period = periodType.createPeriod( date );
+        Period period = periodType.createPeriod( today );
 
-        return (period.getEndDate().equals( date ) || period.getEndDate().before( date )) ? period : null;
+        return ( period.getEndDate().before( today.getTime() )) ? period : null;
     }
 }