dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22328
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10707: Minor fix for completeness program-stage formula of Aggregate query builder.
------------------------------------------------------------
revno: 10707
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-04-29 16:41:34 +0700
message:
Minor fix for completeness program-stage formula of Aggregate query builder.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.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/jdbc/JdbcCaseAggregationConditionManager.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java 2013-04-28 14:35:49 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java 2013-04-29 09:41:34 +0000
@@ -943,22 +943,16 @@
String sql = "";
if ( !flag )
{
- sql = "SELECT " + operator + "(distinct psi.organisationunitid) "
- + " FROM programstageinstance psi ";
+ sql = "SELECT '1' FROM organisationunit ou WHERE ou.organisationunitid=" + orgunitId + " ";
}
else
{
- sql = " AND psi.organisationunitid in ( SELECT psi.organisationunitid "
- + " FROM programstageinstance psi ";
- }
-
- sql += " WHERE psi.organisationunitid=" + orgunitId + " AND psi.completed=true AND psi.programstageid = " + programStageId
- + " AND " + " psi.executiondate >= '" + startDate + "' AND psi.executiondate <= '" + endDate + "' ";
-
- if ( flag )
- {
- sql += ")";
- }
+ sql = " AND NOT EXISTS ( SELECT programstageinstanceid FROM programstageinstance psi "
+ + " WHERE psi.organisationunitid=ou.organisationunitid " + " AND psi.programstageid = "
+ + programStageId + " and psi.completed=false " + " AND psi.executiondate >= '" + startDate
+ + "' and psi.executiondate <= '" + endDate + "' ) ";
+ }
+
return sql;
}