dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37008
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18935: Data approval resource table, included a group by clause to protect against duplicate data approv...
------------------------------------------------------------
revno: 18935
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-17 10:57:30 +0200
message:
Data approval resource table, included a group by clause to protect against duplicate data approval records/integrity issues.
modified:
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.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/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2015-04-16 21:24:00 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2015-04-17 08:57:30 +0000
@@ -595,7 +595,7 @@
String sql =
"insert into " + TABLE_NAME_DATA_APPROVAL_MIN_LEVEL +
" (datasetid,periodid,organisationunitid,attributeoptioncomboid,minlevel) " +
- "select da.datasetid, da.periodid, da.organisationunitid, da.attributeoptioncomboid, dal.level as minlevel " +
+ "select da.datasetid, da.periodid, da.organisationunitid, da.attributeoptioncomboid, min(dal.level) as minlevel " +
"from dataapproval da " +
"inner join dataapprovallevel dal on da.dataapprovallevelid=dal.dataapprovallevelid " +
"where not exists ( " +
@@ -611,7 +611,8 @@
sql += "da.organisationunitid = ous2.idlevel" + level.getLevel() + " or ";
}
- sql = TextUtils.removeLastOr( sql ) + ") );";
+ sql = TextUtils.removeLastOr( sql ) + ") ) " +
+ "group by da.datasetid, da.periodid, da.organisationunitid, da.attributeoptioncomboid;";
log.info( "Insert data approval min level SQL: " + sql );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java 2015-04-17 07:41:39 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java 2015-04-17 08:57:30 +0000
@@ -182,8 +182,7 @@
resourceTableService.generateDataElementTable();
resourceTableService.generatePeriodTable();
resourceTableService.generateDatePeriodTable();
- resourceTableService.generateDataElementCategoryOptionComboTable();
-
+ resourceTableService.generateDataElementCategoryOptionComboTable();
resourceTableService.createAllSqlViews();
}