dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32070
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16391: Minor fix for case aggregate query builder formulas.
------------------------------------------------------------
revno: 16391
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-08-12 22:17:31 +0700
message:
Minor fix for case aggregate query builder formulas.
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-08-03 16:27:47 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java 2014-08-12 15:17:31 +0000
@@ -468,6 +468,7 @@
private String createSQL( String caseExpression, String operator, Collection<Integer> orgunitIds, String startDate,
String endDate )
{
+ caseExpression = caseExpression.replaceAll( "\"", "'" );
boolean orgunitCompletedProgramStage = false;
StringBuffer sqlResult = new StringBuffer();
@@ -715,7 +716,12 @@
}
else
{
- sql += " WHERE _pav.trackedentityinstanceid=pi.trackedentityinstanceid AND _pav.trackedentityattributeid=" + attributeId + " AND _pav.value ";
+ sql += " WHERE _pav.trackedentityinstanceid=pi.trackedentityinstanceid AND _pav.trackedentityattributeid=" + attributeId;
+
+ if( isExist )
+ {
+ sql += " AND _pav.value ";
+ }
}
if ( isExist )
@@ -724,7 +730,7 @@
}
else
{
- sql = " NOT ( " + sql;
+ sql = " NOT EXISTS ( " + sql;
}
return sql;