← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14887: Fixed bug - Exception thrown when to run Schedule automated aggregation.

 

------------------------------------------------------------
revno: 14887
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-17 22:09:08 +0800
message:
  Fixed bug - Exception thrown when to run Schedule automated aggregation.
modified:
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/scheduling/CaseAggregateConditionTask.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/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2014-04-17 14:09:08 +0000
@@ -396,17 +396,20 @@
     }
 
     public void aggregate( List<CaseAggregateSchedule> caseAggregateSchedules, String taskStrategy )
-    {
+    {       
         ConcurrentLinkedQueue<CaseAggregateSchedule> datasetQ = new ConcurrentLinkedQueue<CaseAggregateSchedule>(
             caseAggregateSchedules );
-
         List<Future<?>> futures = new ArrayList<Future<?>>();
 
         for ( int i = 0; i < getProcessNo(); i++ )
-        {
-            futures.add( aggregateValueManager( datasetQ, taskStrategy ) );
+        { 
+            Future<?> future = aggregateValueManager( datasetQ, taskStrategy );
+            if ( future != null )
+            {
+                futures.add( future );
+            }
         }
-
+        
         ConcurrentUtils.waitForCompletion( futures );
     }
 
@@ -476,7 +479,6 @@
         taskLoop: while ( true )
         {
             CaseAggregateSchedule dataSet = caseAggregateSchedule.poll();
-
             if ( dataSet == null )
             {
                 break taskLoop;
@@ -484,7 +486,6 @@
 
             Collection<Period> periods = aggregationConditionStore.getPeriods( dataSet.getPeriodTypeName(),
                 taskStrategy );
-
             aggregationConditionStore.runAggregate( null, dataSet, periods );
         }
 

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/scheduling/CaseAggregateConditionTask.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/scheduling/CaseAggregateConditionTask.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/scheduling/CaseAggregateConditionTask.java	2014-04-17 14:09:08 +0000
@@ -104,7 +104,7 @@
 
         // Get datasets which are used in case-aggregate-query-builder formula
         
-        String datasetSQL = "select dm.datasetid as datasetid, pt.name as periodtypename, ds.name as datasetname";
+        String datasetSQL = "select distinct( dm.datasetid ) as datasetid, pt.name as periodtypename, ds.name as datasetname";
         datasetSQL += "      from caseaggregationcondition cagg inner join datasetmembers dm ";
         datasetSQL += "            on cagg.aggregationdataelementid=dm.dataelementid inner join dataset ds ";
         datasetSQL += "            on ds.datasetid = dm.datasetid inner join periodtype pt ";