← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1706: Made the get objective complete registrations sql query rely on operands rather than dataelements.

 

Merge authors:
  Lars <Lars@Livingroom>
------------------------------------------------------------
revno: 1706 [merge]
committer: Lars <Lars@Livingroom>
branch nick: trunk
timestamp: Sat 2010-03-27 23:59:06 +0100
message:
  Made the get objective complete registrations sql query rely on operands rather than dataelements.
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java
  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/impl/AbstractDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2010-03-22 12:22:45 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java	2010-03-27 20:17:48 +0000
@@ -252,7 +252,7 @@
     {
         final Period period = periodService.getPeriod( periodId );
 
-        Date deadline = getConfiguration().getDeadline( period );
+        Date deadline = getConfiguration() != null ? getConfiguration().getDeadline( period ) : null;
         
         final DataSet dataSet = dataSetService.getDataSet( dataSetId );
         

=== 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-19 13:36:48 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2010-03-27 22:59:06 +0000
@@ -108,17 +108,15 @@
         final String deadlineCriteria = deadline != null ? "AND lastupdated < '" + DateUtils.getMediumDateString( deadline ) + "' " : "";
         
         final String sql = 
-            "SELECT COUNT(sourceid) FROM ( " +
-                "SELECT sourceid, count(DISTINCT dataelementid) AS no " +
+            "SELECT COUNT(completed) FROM ( " +
+                "SELECT COUNT(sourceid) AS sources " +
                 "FROM datavalue " +
+                "JOIN dataelementoperand USING (dataelementid, categoryoptioncomboid) " +
+                "JOIN datasetoperands USING (dataelementoperandid) " +
                 "WHERE periodid = " + periodId + " " + deadlineCriteria +
                 "AND sourceid IN (" + childrenIds + ") " +
-                "AND dataelementid IN ( " +
-                    "SELECT dataelementid " +
-                    "FROM compulsorydatasetmembers " +
-                    "WHERE datasetid = " + dataSetId + " ) " +
-                "GROUP BY sourceid ) AS completed " +
-            "WHERE completed.no = " + compulsoryElements;
+                "AND datasetid = " + dataSetId + ") AS completed " +
+            "WHERE completed.sources = " + compulsoryElements;
         
         return statementManager.getHolder().queryForInteger( sql );
     }    


Follow ups