From 3b815ccbc47f2c2f4975eca9a25b80a38103de4e Mon Sep 17 00:00:00 2001 From: felipee07 <2327625+felipee07@users.noreply.github.com> Date: Sat, 23 Jan 2021 19:53:35 +0000 Subject: [PATCH] Fix larger/smaller condition --- backend/app_sdk/app_base.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index dd48b174..4f75c0da 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -1214,27 +1214,13 @@ class AppBase: return False elif check.lower() == "larger than": - try: - if sourcevalue.isdigit() and destinationvalue.isdigit(): - if int(sourcevalue) > int(destinationvalue): - return True - - print("Not larger than.") - return False - except AttributeError as e: - self.logger.error("Condition larger than failed with values %s and %s: %s" % (sourcevalue, destinationvalue, e)) - return False + if str(sourcevalue).isdigit() and str(destinationvalue).isdigit(): + if int(sourcevalue) > int(destinationvalue): + return True elif check.lower() == "smaller than": - try: - if sourcevalue.isdigit() and destinationvalue.isdigit(): - if int(sourcevalue) < int(destinationvalue): - return True - - print("Not small than.") - return False - except AttributeError as e: - self.logger.error("Condition smaller than failed with values %s and %s: %s" % (sourcevalue, destinationvalue, e)) - return False + if str(sourcevalue).isdigit() and str(destinationvalue).isdigit(): + if int(sourcevalue) < int(destinationvalue): + return True else: self.logger.info("Condition: can't handle %s yet. Setting to true" % check)