dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29315
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14778: Event analytics, fixed bug for queries with period as filter
------------------------------------------------------------
revno: 14778
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-10 22:40:06 +0200
message:
Event analytics, fixed bug for queries with period as filter
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.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/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2014-04-08 18:25:25 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2014-04-10 20:40:06 +0000
@@ -1144,6 +1144,29 @@
}
/**
+ * Replaces the items for the dimension or filter identified by the given key.
+ * No action is taken if no dimensions or filters exist.
+ */
+ public void replaceDimensionOrFilterOptions( String key, List<NameableObject> items )
+ {
+ int dimensionIndex = dimensions.indexOf( new BaseDimensionalObject( key ) );
+
+ if ( dimensionIndex != -1 )
+ {
+ DimensionalObject dim = dimensions.get( dimensionIndex );
+ dimensions.set( dimensionIndex, new BaseDimensionalObject( dim.getDimension(), dim.getDimensionType(), dim.getDimensionName(), items ) );
+ }
+
+ int filterIndex = filters.indexOf( new BaseDimensionalObject( key ) );
+
+ if ( filterIndex != -1 )
+ {
+ DimensionalObject flt = filters.get( filterIndex );
+ filters.set( filterIndex, new BaseDimensionalObject( flt.getDimension(), flt.getDimensionType(), flt.getDimensionName(), items ) );
+ }
+ }
+
+ /**
* Retrieves the options for the given dimension identifier. If the dx dimension
* is specified, all concrete dimensions (in|de|dc|ds) are returned as a single
* dimension. If the co dimension is specified, all category option combos for
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.java 2014-04-10 19:45:11 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventQueryPlanner.java 2014-04-10 20:40:06 +0000
@@ -204,7 +204,7 @@
for ( Partitions partitions : partitionPeriodMap.keySet() )
{
EventQueryParams query = params.instance();
- query.setPeriods( partitionPeriodMap.get( partitions ) );
+ query.replaceDimensionOrFilterOptions( DimensionalObject.PERIOD_DIM_ID, partitionPeriodMap.get( partitions ) );
query.setPartitions( partitions );
queries.add( query );
}