From 8e59d0d8fc75b68774f3553a22e992a062e54fa7 Mon Sep 17 00:00:00 2001
From: Birte Kristina Friesel <birte.friesel@uos.de>
Date: Tue, 12 Mar 2024 09:31:15 +0100
Subject: soft_cast_int_or_float: handle values that already are int/float

---
 lib/utils.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'lib')

diff --git a/lib/utils.py b/lib/utils.py
index 879a53d..3778fc0 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -124,9 +124,11 @@ def soft_cast_int_or_float(n):
     If `n` is empty, returns None.
     If `n` is not numeric, it is left unchanged.
     """
+    if type(n) in (float, int):
+        return n
     if n is None or n == "":
         return None
-    if "." in n:
+    if type(n) is str and "." in n:
         return soft_cast_float(n)
     return soft_cast_int(n)
 
-- 
cgit v1.2.3