From 2d6a6f3cffc93718d405ab9c88c305fb44fd1752 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 4 Jan 2022 17:02:05 +0300 Subject: traits.py: Don't use "value" to check if a record exists The problem with using the "value" record is that it's a floating point number. See on why comparing floating point numbers can be an issue. --- gn3/db/traits.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 2cab94e..338b320 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -110,7 +110,6 @@ def get_trait_csv_sample_data(conn: Any, def update_sample_data(conn: Any, #pylint: disable=[R0913] - trait_name: str, strain_name: str, phenotype_id: int, @@ -261,8 +260,8 @@ def insert_sample_data(conn: Any, #pylint: disable=[R0913] # Return early if an insert already exists! cursor.execute("SELECT Id FROM PublishData where Id = %s " - "AND StrainId = %s AND value = %s ", - (data_id, strain_id, value)) + "AND StrainId = %s", + (data_id, strain_id)) if cursor.fetchone(): # This strain already exists return (0, 0, 0) -- cgit v1.2.3