← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15283: Exception thrown when clicking on the details icon of Aggregate query result.

 

------------------------------------------------------------
revno: 15283
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-05-16 10:37:15 +0800
message:
  Exception thrown when clicking on the details icon of Aggregate query result.
modified:
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.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-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-05-12 14:37:40 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-05-16 02:37:15 +0000
@@ -663,19 +663,19 @@
                 sql += " inner join programstageinstance _psi on _pi.programinstanceid=_psi.programinstanceid ";
                     
                 attributeId = attributeId.split( SEPARATOR_ID )[0];
-                sql += " WHERE _pav.patientid=pi.patientid AND _pav.trackedentityattributeid=" + attributeId + " AND DATE(_psi.executiondate) - DATE( _pav.value ) ";
+                sql += " WHERE _pav.trackedentityinstanceid=pi.trackedentityinstanceid AND _pav.trackedentityattributeid=" + attributeId + " AND DATE(_psi.executiondate) - DATE( _pav.value ) ";
             }
             else  if ( attributeId.split( SEPARATOR_ID )[1].equals( CaseAggregationCondition.FORMULA_AGE ) )
             {
                 sql += " inner join programinstance _pi on _pav.trackedentityinstanceid=_pi.trackedentityinstanceid ";
                     
                 attributeId = attributeId.split( SEPARATOR_ID )[0];
-                sql += " WHERE _pav.patientid=pi.patientid AND _pav.trackedentityattributeid=" + attributeId + " AND DATE(_psi.enrollmentdate) - DATE( _pav.value ) ";
+                sql += " WHERE _pav.trackedentityinstanceid=pi.trackedentityinstanceid AND _pav.trackedentityattributeid=" + attributeId + " AND DATE(_psi.enrollmentdate) - DATE( _pav.value ) ";
             }
         }
         else
         {
-            sql += " WHERE _pav.patientid=pi.patientid AND _pav.trackedentityattributeid=" + attributeId + " AND _pav.value ";
+            sql += " WHERE _pav.trackedentityinstanceid=pi.trackedentityinstanceid AND _pav.trackedentityattributeid=" + attributeId + " AND _pav.value ";
         }
 
         if ( isExist )
@@ -915,11 +915,6 @@
         }
         else
         {
-            if ( hasEntityInstances || operator.equals( CaseAggregationCondition.AGGRERATION_COUNT ) )
-            {
-                sql += "p.name,";
-            }
-
             if ( hasDataelement )
             {
                 sql += "pdv.value,pgs.name as program_stage, psi.executiondate as report_date,";