← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20416: Event analytics, using double as column type for int type data elements. No downside and allows f...

 

------------------------------------------------------------
revno: 20416
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-30 11:51:36 +0200
message:
  Event analytics, using double as column type for int type data elements. No downside and allows for larger values + better precision in indicator calculations.
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	2015-09-21 11:34:41 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2015-09-30 09:51:36 +0000
@@ -393,14 +393,10 @@
      */
     private String getColumnType( ValueType valueType )
     {
-        if ( Double.class.equals( valueType.getJavaClass() ) )
+        if ( Double.class.equals( valueType.getJavaClass() ) || Integer.class.equals( valueType.getJavaClass() ) )
         {
             return statementBuilder.getDoubleColumnType();
         }
-        else if ( Integer.class.equals( valueType.getJavaClass() ) )
-        {
-            return "integer";
-        }
         else if ( Boolean.class.equals( valueType.getJavaClass() ) )
         {
             return "integer";
@@ -421,14 +417,10 @@
      */
     private String getSelectClause( ValueType valueType )
     {
-        if ( Double.class.equals( valueType.getJavaClass() ) )
+        if ( Double.class.equals( valueType.getJavaClass() ) || Integer.class.equals( valueType.getJavaClass() ) )
         {
             return "cast(value as " + statementBuilder.getDoubleColumnType() + ")";
         }
-        else if ( Integer.class.equals( valueType.getJavaClass() ) )
-        {
-            return "cast(value as integer)";
-        }
         else if ( Boolean.class.equals( valueType.getJavaClass() ) )
         {
             return "case when value = 'true' then 1 when value = 'false' then 0 else null end";