← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20147: use aggregation type in DataElementPeriodTypeAllowAverageFilter

 

------------------------------------------------------------
revno: 20147
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-15 11:53:54 +0700
message:
  use aggregation type in DataElementPeriodTypeAllowAverageFilter
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataElementPeriodTypeAllowAverageFilter.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/filter/DataElementPeriodTypeAllowAverageFilter.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataElementPeriodTypeAllowAverageFilter.java	2015-05-28 18:21:56 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/filter/DataElementPeriodTypeAllowAverageFilter.java	2015-09-15 04:53:54 +0000
@@ -28,15 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.analytics.AggregationType;
+import org.hisp.dhis.commons.filter.Filter;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.commons.filter.Filter;
 
 public class DataElementPeriodTypeAllowAverageFilter
     implements Filter<DataElement>
 {
     private String periodType;
-    
+
     public DataElementPeriodTypeAllowAverageFilter( String periodType )
     {
         this.periodType = periodType;
@@ -49,20 +50,20 @@
         {
             return false;
         }
-        
+
         final PeriodType type = PeriodType.getPeriodTypeByName( periodType );
-        
+
         if ( dataElement.getPeriodType().equals( type ) )
         {
             return true;
         }
-        
-        if ( DataElement.AGGREGATION_OPERATOR_AVERAGE_SUM.equals( dataElement.getAggregationOperator() ) && 
+
+        if ( AggregationType.AVERAGE_SUM_ORG_UNIT == dataElement.getAggregationType() &&
             dataElement.getPeriodType().getFrequencyOrder() >= type.getFrequencyOrder() )
         {
             return true;
         }
-        
+
         return false;
     }
 }