← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1707: Fixed bug in completeness sql query

 

------------------------------------------------------------
revno: 1707
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-03-28 17:31:41 +0200
message:
  Fixed bug in completeness sql query
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.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-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2010-03-27 22:59:06 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2010-03-28 15:31:41 +0000
@@ -109,13 +109,13 @@
         
         final String sql = 
             "SELECT COUNT(completed) FROM ( " +
-                "SELECT COUNT(sourceid) AS sources " +
+                "SELECT sourceid, COUNT(sourceid) AS sources " +
                 "FROM datavalue " +
                 "JOIN dataelementoperand USING (dataelementid, categoryoptioncomboid) " +
                 "JOIN datasetoperands USING (dataelementoperandid) " +
                 "WHERE periodid = " + periodId + " " + deadlineCriteria +
                 "AND sourceid IN (" + childrenIds + ") " +
-                "AND datasetid = " + dataSetId + ") AS completed " +
+                "AND datasetid = " + dataSetId + " GROUP BY sourceid) AS completed " +
             "WHERE completed.sources = " + compulsoryElements;
         
         return statementManager.getHolder().queryForInteger( sql );