← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17009: bug fix in event creation

 

------------------------------------------------------------
revno: 17009
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-08 16:18:50 +0200
message:
  bug fix in event creation
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	2014-10-02 10:25:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2014-10-08 14:18:50 +0000
@@ -77,13 +77,10 @@
             setTimeout(function () {
                 $scope.getEvents();
             }, 100);
-            
-            $scope.getEvents();
         }
     });
     
-    $scope.getEvents = function(){
-        
+    $scope.getEvents = function(){        
         $scope.dhis2Events = '';
         DHIS2EventFactory.getEventsByStatus($scope.selectedEntity.trackedEntityInstance, $scope.selectedOrgUnit.id, $scope.selectedProgram.id, 'ACTIVE').then(function(data){
             $scope.dhis2Events = data;            
@@ -217,6 +214,8 @@
                 newEvent.sortingDate = $scope.currentDummyEvent.dueDate,
                 newEvent.statusColor = $scope.currentDummyEvent.statusColor;
                 
+                $scope.dummyEvents = $scope.checkForEventCreation($scope.dhis2Events, $scope.selectedProgram);
+                
                 if(!angular.isObject($scope.dhis2Events)){
                     $scope.dhis2Events = [newEvent];
                 }

=== 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	2014-10-08 11:53:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2014-10-08 14:18:50 +0000
@@ -1213,10 +1213,10 @@
 .service('DateUtils', function($filter){
     
     return {
-        format: function(dateValue) {            
-            dateValue = moment(dateValue, 'YYYY-MM-DD')._d;
+        format: function(dateValue) {
+            dateValue = moment(dateValue, 'YYYY-MM-DD')._d;            
             dateValue = Date.parse(dateValue);
-            dateValue = $filter('date')(dateValue, 'yyyy-MM-dd');
+            dateValue = $filter('date')(dateValue, 'yyyy-MM-dd');            
             return dateValue;
         },
         formatToHrsMins: function(dateValue) {            
@@ -1274,8 +1274,8 @@
         },
         getEventDueDate: function(programStage, enrollment){
             var dueDate = DateUtils.format(enrollment.dateOfIncident);
-            dueDate = moment(dueDate).add('d', programStage.minDaysFromStart)._d;
-            dueDate = DateUtils.format(dueDate);
+            dueDate = moment(enrollment.dateOfIncident).add('d', programStage.minDaysFromStart);
+            dueDate = DateUtils.format(dueDate);            
             return dueDate;
         },
         getEventOrgUnitName: function(orgUnitId){