← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2468: Fixed weakness in report table, removing potential duplicate periods/orgunits coming from selecti...

 

------------------------------------------------------------
revno: 2468
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-06 10:53:49 +0100
message:
  Fixed weakness in report table, removing potential duplicate periods/orgunits coming from selecting static and dynamic objects
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.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-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2011-01-06 09:03:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2011-01-06 09:53:49 +0000
@@ -30,6 +30,8 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -545,7 +547,7 @@
         else
         {
             crossTabPeriods.add( null );
-            reportPeriods = new ArrayList<Period>( allPeriods );
+            reportPeriods = new ArrayList<Period>( new HashSet<Period>( allPeriods ) ); // Remove potential duplicates from relative periods / params
             indexColumns.add( PERIOD_ID );
             indexNameColumns.add( PERIOD_NAME );
         }
@@ -559,7 +561,7 @@
         else
         {
             crossTabUnits.add( null );
-            reportUnits = new ArrayList<OrganisationUnit>( allUnits );
+            reportUnits = new ArrayList<OrganisationUnit>( new HashSet<OrganisationUnit>( allUnits ) ); // Remove potential duplicates from params
             indexColumns.add( ORGANISATIONUNIT_ID );
             indexNameColumns.add( ORGANISATIONUNIT_NAME );
         }