← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19910: tracker-capture: bug fix in tei program report

 

------------------------------------------------------------
revno: 19910
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-08-31 14:49:17 +0200
message:
  tracker-capture: bug fix in tei program report
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.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-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-08-26 10:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-08-31 12:49:17 +0000
@@ -346,7 +346,7 @@
                 newEvent.name = dummyEvent.name;
                 newEvent.reportDateDescription = dummyEvent.reportDateDescription;
                 newEvent.sortingDate = ev.eventDate ? ev.eventDate : ev.dueDate,
-                        newEvent.statusColor = EventUtils.getEventStatusColor(ev);
+                newEvent.statusColor = EventUtils.getEventStatusColor(ev);
                 newEvent.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
                 newEvent.dueDate = DateUtils.formatFromApiToUser(ev.dueDate);
                 newEvent.enrollmentStatus = dummyEvent.enrollmentStatus;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html	2015-04-28 16:02:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/program-details.html	2015-08-31 12:49:17 +0000
@@ -93,7 +93,7 @@
                                     {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.name}}
                                 </td>
                                 <td>
-                                    {{dhis2Event[prStDe.dataElement.id].value}}          
+                                    {{dhis2Event[prStDe.dataElement.id]}}
                                 </td>
                                 <td ng-if="allowProvidedElsewhereExists[dhis2Event.programStage]">
                                     <span ng-if="dhis2Event[prStDe.dataElement.id].providedElsewhere"><i class="fa fa-check"></i></span>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-04-28 16:02:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/report/tei-report-controller.js	2015-08-31 12:49:17 +0000
@@ -68,7 +68,7 @@
                 ev.statusColor = EventUtils.getEventStatusColor(ev); 
 
                 if(ev.eventDate){
-                    ev.eventDate = DateUtils.format(ev.eventDate);
+                    ev.eventDate = DateUtils.formatFromApiToUser(ev.eventDate);
                     ev.sortingDate = ev.eventDate;
                 }
                 else{
@@ -115,51 +115,49 @@
         //they are needed to assign data element names for event data values
         $scope.stagesById = [];  
         $scope.allowProvidedElsewhereExists = [];
+        $scope.prStDes = [];
         
         ProgramStageFactory.getByProgram($scope.selectedProgram).then(function(stages){
             $scope.programStages = stages;
             angular.forEach(stages, function(stage){
                 var providedElsewhereExists = false;
-                for(var i=0; i<stage.programStageDataElements.length && !providedElsewhereExists; i++){                
-                    if(stage.programStageDataElements[i].allowProvidedElsewhere){
+                for(var i=0; i<stage.programStageDataElements.length; i++){                
+                    if(stage.programStageDataElements[i].allowProvidedElsewhere && !providedElsewhereExists){
                         providedElsewhereExists = true;
                         $scope.allowProvidedElsewhereExists[stage.id] = true;
-                    }                
+                    }
+                    $scope.prStDes[stage.programStageDataElements[i].dataElement.id] = stage.programStageDataElements[i];
                 }
 
                 $scope.stagesById[stage.id] = stage;
-            });
-        });
+            });        
         
-        //program reports come grouped in enrollment, process for each enrollment
-        $scope.enrollments = [];        
-        angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){        
-            //format report data values
-            angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
-
-                angular.forEach(ev.notes, function(note){
-                    note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
-                }); 
-
-                if(ev.dataValues){
-                    angular.forEach(ev.dataValues, function(dv){
-                        if(dv.dataElement){
-                            ev[dv.dataElement] = dv;
-                        }                    
+            //program reports come grouped in enrollment, process for each enrollment
+            $scope.enrollments = [];        
+            angular.forEach(Object.keys($scope.selectedReport.enrollments), function(enr){        
+                //format report data values
+                angular.forEach($scope.selectedReport.enrollments[enr], function(ev){
+
+                    angular.forEach(ev.notes, function(note){
+                        note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
                     });
-                }
-            });
-
-            //get enrollment details
-            EnrollmentService.get(enr).then(function(enrollment){
-                enrollment.dateOfEnrollment = DateUtils.formatFromApiToUser(enrollment.dateOfEnrollment);
-                enrollment.dateOfIncident = DateUtils.formatFromApiToUser(enrollment.dateOfIncident);            
-                angular.forEach(enrollment.notes, function(note){
-                    note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
-                });            
-                $scope.enrollments.push(enrollment);               
-            });
-        });    
+
+                    if(ev.dataValues){
+                        ev = EventUtils.processEvent(ev, $scope.stagesById[ev.programStage], $scope.optionSets, $scope.prStDes);
+                    }
+                });
+
+                //get enrollment details
+                EnrollmentService.get(enr).then(function(enrollment){
+                    enrollment.dateOfEnrollment = DateUtils.formatFromApiToUser(enrollment.dateOfEnrollment);
+                    enrollment.dateOfIncident = DateUtils.formatFromApiToUser(enrollment.dateOfIncident);            
+                    angular.forEach(enrollment.notes, function(note){
+                        note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
+                    });            
+                    $scope.enrollments.push(enrollment);               
+                });
+            });    
+        });
     };
     
     $scope.close = function(){