← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12318: minor fix for timeliness

 

------------------------------------------------------------
revno: 12318
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-30 13:36:47 +0200
message:
  minor fix for timeliness
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/RegistrationDataSetCompletenessService.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-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessStore.java	2013-09-30 11:36:47 +0000
@@ -28,10 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.dataset.DataSet;
+
 import java.util.Collection;
 
-import org.hisp.dhis.dataset.DataSet;
-
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -39,42 +39,42 @@
 public interface DataSetCompletenessStore
 {
     String ID = DataSetCompletenessStore.class.getName();
-    
+
     Integer getCompleteDataSetRegistrations( DataSet dataSet, Collection<Integer> periods, Collection<Integer> relevantSources );
-    
-    Integer getCompleteDataSetRegistrations( DataSet dataSet, Collection<Integer> periods, Collection<Integer> relevantSources, int completenessOffset );
+
+    Integer getCompleteDataSetRegistrationsWithTimeliness( DataSet dataSet, Collection<Integer> periods, Collection<Integer> relevantSources );
 
     Integer getCompulsoryDataElementRegistrations( DataSet dataSet, Collection<Integer> children, Collection<Integer> periods );
-    
+
     Integer getCompulsoryDataElementRegistrations( DataSet dataSet, Collection<Integer> children, Collection<Integer> periods, int completenessOffset );
 
     Collection<DataSet> getDataSetsWithRegistrations( Collection<DataSet> dataSets );
-    
+
     /**
      * Gets the percentage value for the datasetcompleteness with the given parameters.
-     * 
+     *
      * @param dataSetId the DataSet identifier.
-     * @param periodId the Period identifier.
-     * @param sourceId the Source identifier.
+     * @param periodId  the Period identifier.
+     * @param sourceId  the Source identifier.
      * @return the percentage value for the datasetcompleteness result with the given parameters.
      */
     Double getPercentage( int dataSetId, int periodId, int sourceId );
-    
+
     /**
      * Deletes the datasetcompleteness entries with the given parameters.
-     * 
+     *
      * @param dataSetIds the DataSet identifiers.
-     * @param periodIds the Period identifiers.
-     * @param sourceIds the Source identifiers.
+     * @param periodIds  the Period identifiers.
+     * @param sourceIds  the Source identifiers.
      */
     void deleteDataSetCompleteness( Collection<Integer> dataSetIds, Collection<Integer> periodIds, Collection<Integer> sourceIds );
-    
+
     /**
      * Deletes all datasetcompleteness entries.
      */
     void deleteDataSetCompleteness();
-    
+
     void createIndex();
-    
+
     void dropIndex();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/RegistrationDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/RegistrationDataSetCompletenessService.java	2013-09-30 10:39:35 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/RegistrationDataSetCompletenessService.java	2013-09-30 11:36:47 +0000
@@ -48,7 +48,7 @@
     @Override
     public int getRegistrationsOnTime( DataSet dataSet, Collection<Integer> relevantSources, Collection<Integer> periods )
     {
-        return completenessStore.getCompleteDataSetRegistrations( dataSet, periods, relevantSources );
+        return completenessStore.getCompleteDataSetRegistrationsWithTimeliness( dataSet, periods, relevantSources );
     }
 
     @Override

=== 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	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/jdbc/JDBCDataSetCompletenessStore.java	2013-09-30 11:36:47 +0000
@@ -92,7 +92,7 @@
         return statementManager.getHolder().queryForInteger( sql );
     }
 
-    public Integer getCompleteDataSetRegistrations( DataSet dataSet, Collection<Integer> periods, Collection<Integer> relevantSources, int completenessOffset )
+    public Integer getCompleteDataSetRegistrationsWithTimeliness( DataSet dataSet, Collection<Integer> periods, Collection<Integer> relevantSources )
     {
         if ( relevantSources == null || relevantSources.isEmpty() || periods == null || periods.isEmpty() )
         {
@@ -106,7 +106,7 @@
             "WHERE cr.datasetid = " + dataSet.getId() + " " +
             "AND cr.periodid IN ( " + getCommaDelimitedString( periods ) + " ) " +
             "AND cr.sourceid IN ( " + getCommaDelimitedString( relevantSources ) + " ) " +
-            "AND cr.date <= " + statementBuilder.getAddDate( "pe.enddate", completenessOffset );
+            "AND cr.date <= " + statementBuilder.getAddDate( "pe.enddate", dataSet.getTimelyDays() );
         
         return statementManager.getHolder().queryForInteger( sql );
     }