← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9286: Exception when to run Age at visit (days since birth) formula.

 

------------------------------------------------------------
revno: 9286
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-12-13 10:16:57 +0700
message:
  Exception when to run Age at visit (days since birth) formula.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.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/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2012-11-16 03:50:03 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2012-12-13 03:16:57 +0000
@@ -226,7 +226,7 @@
         Period period )
     {
         String sql = convertCondition( aggregationCondition, orgunit, period );
-
+System.out.println("\n\n ==== \n sql : " + sql );
         Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
 
         if ( patientIds == null )
@@ -868,8 +868,10 @@
             sql = "SELECT psi.programstageinstance ";
             from = "FROM programstageinstance psi ";
         }
+        
+        from +=  "inner join patient p on p.patientid=pi.patientid ";
 
-        sql += from + "WHERE executionDate<='" + startDate + "' and executionDate>='" + endDate + "' and "
+        sql += from + "WHERE executionDate>='" + startDate + "' and executionDate<='" + endDate + "' and "
             + propertyName;
 
         return sql;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java	2012-11-02 05:10:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java	2012-12-13 03:16:57 +0000
@@ -232,7 +232,7 @@
         // Get selected periods list
         // ---------------------------------------------------------------------
 
-        CalendarPeriodType periodType = (CalendarPeriodType) selectedDataSet.getPeriodType();
+        CalendarPeriodType periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( selectedDataSet.getPeriodType().getName() );
 
         periods.addAll( periodType.generatePeriods( format.parseDate( startDate ), format.parseDate( endDate ) ) );