← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16804: ValidationUtils, fix related to average agg operators

 

------------------------------------------------------------
revno: 16804
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-09-24 16:48:25 +0200
message:
  ValidationUtils, fix related to average agg operators
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java	2014-09-23 07:43:22 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ValidationUtils.java	2014-09-24 14:48:25 +0000
@@ -29,6 +29,7 @@
  */
 
 import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_AVERAGE_SUM;
+import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_AVERAGE;
 import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_BOOL;
 import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_DATE;
 import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_INT;
@@ -350,8 +351,10 @@
      */
     public static boolean dataValueIsZeroAndInsignificant( String value, DataElement dataElement )
     {
-        return VALUE_TYPE_INT.equals( dataElement.getType() ) && MathUtils.isZero( value ) &&
-            !dataElement.isZeroIsSignificant() && !AGGREGATION_OPERATOR_AVERAGE_SUM.equals( dataElement.getAggregationOperator() );
+        String aggOperator = dataElement.getAggregationOperator();
+        
+        return VALUE_TYPE_INT.equals( dataElement.getType() ) && MathUtils.isZero( value ) && !dataElement.isZeroIsSignificant() && 
+            !( AGGREGATION_OPERATOR_AVERAGE_SUM.equals( aggOperator ) || AGGREGATION_OPERATOR_AVERAGE.equals( aggOperator ) );
     }
     
     /**