← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19265: some cleanup

 

------------------------------------------------------------
revno: 19265
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-06-02 21:07:17 +0200
message:
  some cleanup
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
  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/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-06-02 12:25:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-06-02 19:07:17 +0000
@@ -65,8 +65,7 @@
                     </div>
                     <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.type">
                         <div ng-switch-when="int">
-                            <input type="number"
-                                   string-to-number
+                            <input type="number"                                   
                                    number-type={{prStDe.dataElement.numberType}}
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                    ng-model="currentEvent[prStDe.dataElement.id]"                                    

=== 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-06-02 12:25:03 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-06-02 19:07:17 +0000
@@ -65,17 +65,14 @@
     };
     
     function processPeriodsForEvent(periods,event){
-        //console.log('the event:  ', event.sortingDate, ' - ', periods);
         var index = -1;
         var occupied = null;
         for(var i=0; i<periods.length && index === -1; i++){
-            //console.log(event.sortingDate, ' - ', periods[i].startDate, ' - ', periods[i].endDate);
             if(moment(periods[i].endDate).isSame(event.sortingDate) ||
                     moment(periods[i].startDate).isSame(event.sortingDate) ||
                     moment(periods[i].endDate).isAfter(event.sortingDate) && moment(event.sortingDate).isAfter(periods[i].endDate)){
                 index = i;
                 occupied = angular.copy(periods[i]);
-                //console.log('Found it:  ', event.sortingDate, ' - ', periods[i].startDate, ' - ', periods[i].endDate);
             }
         }
         
@@ -83,7 +80,6 @@
             periods.splice(index,1);
         }
         
-        //console.log('the returned period:  ', periods);
         return {available: periods, occupied: occupied};
     };
     
@@ -122,11 +118,7 @@
                 p.endDate = DateUtils.formatFromApiToUser(p.endDate);
                 p.startDate = DateUtils.formatFromApiToUser(p.startDate);
                 
-                /*if(moment(p.endDate).isAfter(eventDateOffSet)){
-                    availablePeriods[p.endDate] = p;
-                }*/   
-                if(moment(p.endDate).isAfter(eventDateOffSet)){
-                    //availablePeriods[p.endDate] = p;
+                if(moment(p.endDate).isAfter(eventDateOffSet)){                    
                     availablePeriods.push( p );
                 }
             });                
@@ -138,11 +130,6 @@
                 if(ps.occupied){
                     occupiedPeriods.push(ps.occupied);
                 }
-                /*var p = availablePeriods[event.sortingDate];
-                if(p){
-                    occupiedPeriods.push({event: event.event, name: p.name, stage: stage.id, eventDate: event.sortingDate});
-                    delete availablePeriods[event.sortingDate];
-                }*/                    
             });
         }
         return {occupiedPeriods: occupiedPeriods, availablePeriods: availablePeriods};
@@ -914,7 +901,15 @@
                 }                
             }
             else{
-                if(val){
+                if(val){                    
+                    if( type === 'number' ){
+                        if(dhis2.validation.isNumber(val)){                            
+                            val = new Number(val);
+                        }
+                        else{
+                            val = new Number('0');
+                        }
+                    }
                     if(type === 'date'){
                         if(destination === 'USER'){
                             val = DateUtils.formatFromApiToUser(val);
@@ -1608,8 +1603,8 @@
                     if(prStDe.dataElement){                               
                         if(val && prStDe.dataElement.type === 'int' ){
                             if( dhis2.validation.isNumber(val)  ){                            
-                                //val = parseInt(val);
-                                val = new Number(val);
+                                val = parseInt(val);
+                                //val = new Number(val);
                             }
                         }
                         if(val && prStDe.dataElement.optionSetValue && optionSets[prStDe.dataElement.optionSet.id].options  ){