dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22163
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10631: Fixed bug related to available/selected list in compulsory operand ui
------------------------------------------------------------
revno: 10631
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-04-19 11:20:59 +0200
message:
Fixed bug related to available/selected list in compulsory operand ui
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/compulsory/GetCompulsoryDataElementsAction.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/dataelement/DataElementOperand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2013-04-18 13:39:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java 2013-04-19 09:20:59 +0000
@@ -493,7 +493,6 @@
// hashCode, equals, toString, compareTo
// -------------------------------------------------------------------------
-
@Override
public String toString()
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/compulsory/GetCompulsoryDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/compulsory/GetCompulsoryDataElementsAction.java 2013-04-18 13:39:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/compulsory/GetCompulsoryDataElementsAction.java 2013-04-19 09:20:59 +0000
@@ -29,6 +29,7 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -109,8 +110,26 @@
availableOperands = new ArrayList<DataElementOperand>( dataElementCategoryService.getOperands( dataSet.getDataElements() ) );
- availableOperands.removeAll( selectedOperands );
-
+ Iterator<DataElementOperand> availableIter = availableOperands.iterator();
+
+ // ---------------------------------------------------------------------
+ // Remove already selected operands - must check manually since selected
+ // operands are persisted while available operands are generated
+ // ---------------------------------------------------------------------
+
+ while ( availableIter.hasNext() )
+ {
+ DataElementOperand availableOperand = availableIter.next();
+
+ for ( DataElementOperand selectedOperand : selectedOperands )
+ {
+ if ( availableOperand.getOperandExpression().equals( selectedOperand.getOperandExpression() ) )
+ {
+ availableIter.remove();
+ }
+ }
+ }
+
Collections.sort( availableOperands, new DataElementOperandNameComparator() );
return SUCCESS;