← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21594: Analytics tables. Updated approval to reflect workflows.

 

------------------------------------------------------------
revno: 21594
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-01-05 16:53:39 +0100
message:
  Analytics tables. Updated approval to reflect workflows.
modified:
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataApprovalMinLevelResourceTable.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.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-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataApprovalMinLevelResourceTable.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataApprovalMinLevelResourceTable.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/table/DataApprovalMinLevelResourceTable.java	2016-01-05 15:53:39 +0000
@@ -58,7 +58,7 @@
     public String getCreateTempTableStatement()
     {
         String sql = "create table " + getTempTableName() + "(" +
-            "datasetid integer not null, " +
+            "workflowid integer not null, " +
             "periodid integer not null, " +
             "organisationunitid integer not null, " +
             "attributeoptioncomboid integer not null, " +
@@ -72,15 +72,15 @@
     {
         String sql = 
             "insert into " + getTempTableName() + 
-            " (datasetid,periodid,organisationunitid,attributeoptioncomboid,minlevel) " +
-            "select da.datasetid, da.periodid, da.organisationunitid, da.attributeoptioncomboid, dal.level as minlevel " +
+            " (workflowid,periodid,organisationunitid,attributeoptioncomboid,minlevel) " +
+            "select da.workflowid, da.periodid, da.organisationunitid, da.attributeoptioncomboid, dal.level as minlevel " +
             "from dataapproval da " +
             "inner join dataapprovallevel dal on da.dataapprovallevelid=dal.dataapprovallevelid " +
             "where not exists ( " +
                 "select 1 from dataapproval da2 " +
                 "inner join dataapprovallevel dal2 on da2.dataapprovallevelid=dal2.dataapprovallevelid " +
                 "inner join _orgunitstructure ous2 on da2.organisationunitid=ous2.organisationunitid " +
-                "where da.datasetid=da2.datasetid and da.periodid=da2.periodid and da.attributeoptioncomboid=da2.attributeoptioncomboid " +
+                "where da.workflowid=da2.workflowid and da.periodid=da2.periodid and da.attributeoptioncomboid=da2.attributeoptioncomboid " +
                 "and dal2.level < dal.level " +
                 "and ( ";
         
@@ -103,12 +103,10 @@
     @Override
     public List<String> getCreateIndexStatements()
     {
-        String sql = 
-            "create index in_dataapprovalminlevel_datasetid_" + getRandomSuffix() + " on " + getTempTableName() + "(datasetid);" +
-            "create index in_dataapprovalminlevel_periodid_" + getRandomSuffix() + " on " + getTempTableName() + "(periodid);" +
-            "create index in_dataapprovalminlevel_organisationunitid_" + getRandomSuffix() + " on " + getTempTableName() + "(organisationunitid);" +
-            "create index in_dataapprovalminlevel_attributeoptioncomboid_" + getRandomSuffix() + " on " + getTempTableName() + "(attributeoptioncomboid);";
-        
-        return Lists.newArrayList( sql );        
+        return Lists.newArrayList(
+            "create index in_dataapprovalminlevel_workflowidid_" + getRandomSuffix() + " on " + getTempTableName() + "(workflowid);",
+            "create index in_dataapprovalminlevel_periodid_" + getRandomSuffix() + " on " + getTempTableName() + "(periodid);",
+            "create index in_dataapprovalminlevel_organisationunitid_" + getRandomSuffix() + " on " + getTempTableName() + "(organisationunitid);",
+            "create index in_dataapprovalminlevel_attributeoptioncomboid_" + getRandomSuffix() + " on " + getTempTableName() + "(attributeoptioncomboid);" );        
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2016-01-05 15:53:39 +0000
@@ -271,7 +271,7 @@
         {
             String sql =
                 "left join _dataapprovalminlevel da " +
-                    "on des.datasetid=da.datasetid and da.periodid=dv.periodid and da.attributeoptioncomboid=dv.attributeoptioncomboid " +
+                    "on des.workflowid=da.workflowid and da.periodid=dv.periodid and da.attributeoptioncomboid=dv.attributeoptioncomboid " +
                     "and (";
 
             Set<OrganisationUnitLevel> levels = dataApprovalLevelService.getOrganisationUnitApprovalLevels();