← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21459: Avoid rounding for Number type

 

------------------------------------------------------------
revno: 21459
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-12-15 16:26:01 +0100
message:
  Avoid rounding for Number type
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-12-05 16:20:29 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-12-15 15:26:01 +0000
@@ -272,8 +272,12 @@
                     obj.valueType === 'INTEGER_POSITIVE' ||
                     obj.valueType === 'INTEGER_NEGATIVE' ||
                     obj.valueType === 'INTEGER_ZERO_OR_POSITIVE'){
-                if( dhis2.validation.isNumber(val)  ){                            
-                    val = parseInt(val);
+                if( dhis2.validation.isNumber(val)){
+                    if(obj.valueType === 'NUMBER'){
+                        val = parseFloat(val);
+                    }else{
+                        val = parseInt(val);
+                    }
                 }
             }
             if(val && obj.optionSetValue && obj.optionSet && obj.optionSet.id && optionSets[obj.optionSet.id].options  ){