dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19888
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8864: [mobile] minor fix aggregate reporting
------------------------------------------------------------
revno: 8864
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Mon 2012-11-05 11:36:04 +0700
message:
[mobile] minor fix aggregate reporting
modified:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java 2012-07-25 13:18:48 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java 2012-11-05 04:36:04 +0000
@@ -34,7 +34,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.Validate;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
@@ -51,6 +50,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.YearlyPeriodType;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.filter.OrganisationUnitWithDataSetsFilter;
import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
@@ -149,17 +149,17 @@
{
Map<String, DeflatedDataValue> validationErrorMap = new HashMap<String, DeflatedDataValue>();
- Double factor = (Double) systemSettingManager.getSystemSetting(
- SystemSettingManager.KEY_FACTOR_OF_DEVIATION, 2.0 );
-
- Collection<DeflatedDataValue> stdDevs = stdDevOutlierAnalysisService.analyse( ListUtils.getCollection( organisationUnit ),
- dataElements, ListUtils.getCollection( period ), factor );
-
- Collection<DeflatedDataValue> minMaxs = minMaxOutlierAnalysisService.analyse( ListUtils.getCollection( organisationUnit ),
- dataElements, ListUtils.getCollection( period ), null );
+ Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION,
+ 2.0 );
+
+ Collection<DeflatedDataValue> stdDevs = stdDevOutlierAnalysisService.analyse(
+ ListUtils.getCollection( organisationUnit ), dataElements, ListUtils.getCollection( period ), factor );
+
+ Collection<DeflatedDataValue> minMaxs = minMaxOutlierAnalysisService.analyse(
+ ListUtils.getCollection( organisationUnit ), dataElements, ListUtils.getCollection( period ), null );
Collection<DeflatedDataValue> deflatedDataValues = CollectionUtils.union( stdDevs, minMaxs );
-
+
for ( DeflatedDataValue deflatedDataValue : deflatedDataValues )
{
String key = String.format( "DE%dOC%d", deflatedDataValue.getDataElementId(),
@@ -260,7 +260,16 @@
DataSet dataSet = dataSetService.getDataSet( dataSetId );
- CalendarPeriodType periodType = (CalendarPeriodType) dataSet.getPeriodType();
+ CalendarPeriodType periodType = null;
+ if ( dataSet.getPeriodType().getName().equalsIgnoreCase( "Yearly" ) )
+ {
+ periodType = (CalendarPeriodType) new YearlyPeriodType();
+ }
+ else
+ {
+ periodType = (CalendarPeriodType) dataSet.getPeriodType();
+ }
+
List<Period> periods = periodType.generateLast5Years( new Date() );
FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
Collections.reverse( periods );