← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12984: fixed optionSet bug in data-entry, now uses all optionCombos for generating meta-data

 

------------------------------------------------------------
revno: 12984
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-11-20 11:28:18 +0100
message:
  fixed optionSet bug in data-entry, now uses all optionCombos for generating meta-data
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm


--
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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-10-08 13:40:12 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-11-20 10:28:18 +0000
@@ -214,7 +214,7 @@
 	        dataElements = metaData.dataElements;
 	        indicatorFormulas = metaData.indicatorFormulas;
 	        dataSets = metaData.dataSets;
-            optionSets = metaData.optionSets;
+          optionSets = metaData.optionSets;
 	        dataSetAssociationSets = metaData.dataSetAssociationSets;
 	        organisationUnitAssociationSetMap = metaData.organisationUnitAssociationSetMap;
 
@@ -2370,20 +2370,20 @@
 }
 
 function insertOptionSets() {
-    $( '.entryoptionset' ).each( function ( idx, item ) {
-        var optionSetKey = splitFieldId( item.id );
-
-        if ( multiOrganisationUnit ) {
-            item = optionSetKey.organisationUnitId + '-' + optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
-        } else {
-            item = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
-        }
-
-        item = item + '-val';
-        optionSetKey = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
-
-        autocompleteOptionSetField( item, optionSets[optionSetKey].uid );
-    } );
+  $('.entryoptionset').each(function( idx, item ) {
+    var optionSetKey = splitFieldId(item.id);
+
+    if( multiOrganisationUnit ) {
+      item = optionSetKey.organisationUnitId + '-' + optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
+    } else {
+      item = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
+    }
+
+    item = item + '-val';
+    optionSetKey = optionSetKey.dataElementId + '-' + optionSetKey.optionComboId;
+
+    autocompleteOptionSetField(item, optionSets[optionSetKey].uid);
+  });
 }
 
 function autocompleteOptionSetField( idField, optionSetUid ) {

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm	2013-08-06 07:28:56 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm	2013-11-20 10:28:18 +0000
@@ -16,7 +16,11 @@
 "optionSets": {
 #set( $size = $dataElementsWithOptionSet.size() )
 #foreach( $dataElement in $dataElementsWithOptionSet )
-"${dataElement.uid}-${dataElement.categoryCombo.getSortedOptionCombos().get(0).uid}":{"uid": "$encoder.jsonEncode( ${dataElement.optionSet.uid} )", "v":${dataElement.optionSet.version}}
+  #set( $size2 = $dataElement.categoryCombo.getSortedOptionCombos().size() )
+  #foreach( $option in $dataElement.categoryCombo.getSortedOptionCombos() )
+  "${dataElement.uid}-$option.uid":{"uid": "$encoder.jsonEncode( ${dataElement.optionSet.uid} )", "v":${dataElement.optionSet.version}}
+  #if( $velocityCount < $size2 ),#end
+  #end
 #if( $velocityCount < $size ),#end
 #end },