← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13194: Event analytics, table generation more robust

 

------------------------------------------------------------
revno: 13194
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-10 16:26:25 +0100
message:
  Event analytics, table generation more robust
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.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-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2013-12-10 14:17:42 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2013-12-10 15:26:25 +0000
@@ -70,20 +70,25 @@
     @Transactional
     public List<AnalyticsTable> getTables( Date earliest, Date latest )
     {
-        String baseName = getTableName();
-        
-        List<Period> periods = PartitionUtils.getPeriods( earliest, latest );
+        log.info( "Get tables using earliest: " + earliest + ", latest: " + latest );
 
         List<AnalyticsTable> tables = new ArrayList<AnalyticsTable>();
-        
-        for ( Period period : periods )
-        {
-            for ( Program program : programService.getAllPrograms() )
+
+        if ( earliest != null && latest != null )
+        {        
+            String baseName = getTableName();
+            
+            List<Period> periods = PartitionUtils.getPeriods( earliest, latest );
+    
+            for ( Period period : periods )
             {
-                AnalyticsTable table = new AnalyticsTable( baseName, null, period, program );
-                List<String[]> dimensionColumns = getDimensionColumns( table );
-                table.setDimensionColumns( dimensionColumns );                
-                tables.add( table );
+                for ( Program program : programService.getAllPrograms() )
+                {
+                    AnalyticsTable table = new AnalyticsTable( baseName, null, period, program );
+                    List<String[]> dimensionColumns = getDimensionColumns( table );
+                    table.setDimensionColumns( dimensionColumns );                
+                    tables.add( table );
+                }
             }
         }