climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1489627 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
Date Tue, 04 Jun 2013 21:30:40 GMT
Author: joyce
Date: Tue Jun  4 21:30:26 2013
New Revision: 1489627

URL: http://svn.apache.org/r1489627
Log:
Resolves CLIMATE-82 - checkParameters does bad comparisons

- All comparisons in checkParameters for the lat/lon values first
  converts the operands to floats with parseFloat() to ensure that the
  comparisons done aren't string comparisons.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js?rev=1489627&r1=1489626&r2=1489627&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers.js Tue Jun  4 21:30:26 2013
@@ -241,17 +241,22 @@ function ParameterSelectCtrl($rootScope,
 	// Check the Parameter selection boxes after the user has changed input to ensure that valid
 	// values were entered
 	$scope.checkParameters = function() {
-		if ($scope.displayParams.latMin < $scope.latMin) 
+		if (parseFloat($scope.displayParams.latMin) < parseFloat($scope.latMin))
 			$scope.displayParams.latMin = $scope.latMin;
-		if ($scope.displayParams.latMax > $scope.latMax) 
+
+		if (parseFloat($scope.displayParams.latMax) > parseFloat($scope.latMax))
 			$scope.displayParams.latMax = $scope.latMax;
-		if ($scope.displayParams.lonMin < $scope.lonMin) 
+
+		if (parseFloat($scope.displayParams.lonMin) < parseFloat($scope.lonMin)) 
 			$scope.displayParams.lonMin = $scope.lonMin;
-		if ($scope.displayParams.lonMax > $scope.lonMax) 
+
+		if (parseFloat($scope.displayParams.lonMax) > parseFloat($scope.lonMax)) 
 			$scope.displayParams.lonMax = $scope.lonMax;
+
 		if ($scope.displayParams.start < $scope.start) 
 			$scope.displayParams.start = $scope.start;
-		if ($scope.displayParams.end > $scope.end) 
+
+		if ($scope.displayParams.end > $scope.end)
 			$scope.displayParams.end = $scope.end;
 
 		$scope.$apply();



Mime
View raw message