← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14950: removing event data values from data entry display if their data elements are not part of program...

 

------------------------------------------------------------
revno: 14950
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2014-04-23 13:57:39 +0200
message:
  removing event data values from data entry display if their data elements are not part of program stage anymore
modified:
  dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js


--
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-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-04-18 17:56:57 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-04-23 11:57:39 +0000
@@ -148,36 +148,41 @@
                 if( angular.isObject( $scope.dhis2Events ) ) {
 
                     for(var i=0; i < $scope.dhis2Events.length; i++){  
+                        
                         //check if event is empty
-                        if(!angular.isUndefined($scope.dhis2Events[i].dataValues)){
-                            $scope.dhis2Events[i].dataValues = orderByFilter($scope.dhis2Events[i].dataValues, '-dataElement');
+                        if(!angular.isUndefined($scope.dhis2Events[i].dataValues)){                            
+                            
                             angular.forEach($scope.dhis2Events[i].dataValues, function(dataValue){
 
                                 //converting event.datavalues[i].datavalue.dataelement = value to
-                                //event[dataElement] = value for easier grid display.
-                                var dataElement = $scope.programStageDataElements[dataValue.dataElement].dataElement;
-                                if(angular.isObject(dataElement)){                               
-                                    
-                                    //converting int string value to integer for proper sorting.
-                                    if(dataElement.type == 'int'){
-                                        if( !isNaN(parseInt(dataValue.value)) ){
-                                            dataValue.value = parseInt(dataValue.value);
-                                        }
-                                        else{
-                                            dataValue.value = '';
-                                        }                                        
-                                    }
-                                    else if( dataElement.type == 'trueOnly'){
-                                        if(dataValue.value == 'true'){
-                                            dataValue.value = true;
-                                        }
-                                        else{
-                                            dataValue.value = false;
-                                        }
-                                    }
-                                    
-                                    $scope.dhis2Events[i][dataValue.dataElement] = dataValue.value; 
-                                }                                
+                                //event[dataElement] = value for easier grid display.                                
+                                if($scope.programStageDataElements[dataValue.dataElement]){                                    
+                                    
+                                    var dataElement = $scope.programStageDataElements[dataValue.dataElement].dataElement;
+                                    
+                                    if(angular.isObject(dataElement)){                               
+
+                                        //converting int string value to integer for proper sorting.
+                                        if(dataElement.type == 'int'){
+                                            if( !isNaN(parseInt(dataValue.value)) ){
+                                                dataValue.value = parseInt(dataValue.value);
+                                            }
+                                            else{
+                                                dataValue.value = '';
+                                            }                                        
+                                        }
+                                        else if( dataElement.type == 'trueOnly'){
+                                            if(dataValue.value == 'true'){
+                                                dataValue.value = true;
+                                            }
+                                            else{
+                                                dataValue.value = false;
+                                            }
+                                        }                                    
+                                    }                                    
+                                }
+                                
+                                $scope.dhis2Events[i][dataValue.dataElement] = dataValue.value; 
                             });  
 
                             delete $scope.dhis2Events[i].dataValues;