← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18122: tracker capture - bug fix in immediately updating status of newly created events

 

------------------------------------------------------------
revno: 18122
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-26 10:43:10 +0100
message:
  tracker capture - bug fix in immediately updating status of newly created events
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/scripts/services.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-01-20 11:48:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-01-26 09:43:10 +0000
@@ -125,7 +125,8 @@
         var dummyEvents = [];        
         if($scope.selectedEnrollment.status === 'ACTIVE'){
             if(!angular.isObject(availableEvents)){
-                angular.forEach($scope.selectedProgram.programStages, function(programStage){                                                        
+                angular.forEach($scope.selectedProgram.programStages, function(ps){                                                        
+                    var programStage = $scope.selectedProgramWithStage[ps.id];
                     var dummyEvent = EventUtils.createDummyEvent(availableEvents, programStage, $scope.selectedOrgUnit, $scope.selectedEnrollment);
                     dummyEvents.push(dummyEvent);                         
                 });
@@ -150,7 +151,8 @@
                     }                    
                 });
 
-                angular.forEach(program.programStages, function(stage){
+                angular.forEach(program.programStages, function(ps){
+                    var stage = $scope.selectedProgramWithStage[ps.id];
                     if(!eventsPerStage[stage.id]){
                         $scope.allowEventCreation = true;
                         var dummyEvent = EventUtils.createDummyEvent(availableEvents, stage, $scope.selectedOrgUnit, $scope.selectedEnrollment);
@@ -239,6 +241,13 @@
                 newEvent.reportDateDescription = $scope.currentDummyEvent.reportDateDescription;
                 newEvent.sortingDate = $scope.currentDummyEvent.dueDate,
                 newEvent.statusColor = $scope.currentDummyEvent.statusColor;
+                newEvent.eventDate = $scope.currentDummyEvent.eventDate;
+                newEvent.dueDate =  $scope.currentDummyEvent.dueDate;
+                newEvent.enrollmentStatus = $scope.currentDummyEvent.enrollmentStatus;
+                
+                if($scope.currentDummyEvent.coordinate){
+                    newEvent.coordinate = {};
+                }                
                 
                 $scope.dummyEvents = $scope.checkForEventCreation($scope.dhis2Events, $scope.selectedProgram);
                 
@@ -254,10 +263,8 @@
         });
     };   
     
-    $scope.showDataEntry = function(event, rightAfterEnrollment){        
+    $scope.showDataEntry = function(event, rightAfterEnrollment){  
         
-        //$scope.dueDateSaved = false;
-        //$scope.eventDateSaved = false;
         if(event){
 
             if($scope.currentEvent && !rightAfterEnrollment && $scope.currentEvent.event === event.event){

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-01-19 15:36:42 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-01-26 09:43:10 +0000
@@ -1113,7 +1113,7 @@
 
 .service('EventUtils', function(DateUtils, CalendarService, OptionSetService, OrgUnitService, $filter, orderByFilter){
     return {
-        createDummyEvent: function(events, programStage, orgUnit, enrollment){            
+        createDummyEvent: function(events, programStage, orgUnit, enrollment){
             var today = DateUtils.getToday();    
             var dueDate = this.getEventDueDate(events, programStage, enrollment);
             var dummyEvent = {programStage: programStage.id, 
@@ -1123,6 +1123,7 @@
                               sortingDate: dueDate,
                               name: programStage.name,
                               reportDateDescription: programStage.reportDateDescription,
+                              enrollmentStatus: 'ACTIVE',
                               status: 'SCHEDULED'};
             
             if(programStage.captureCoordinates){