aboutsummaryrefslogtreecommitdiff
path: root/gn3/db/traits.py
diff options
context:
space:
mode:
authorBonfaceKilz2022-01-04 17:02:05 +0300
committerBonfaceKilz2022-01-04 17:04:28 +0300
commit2d6a6f3cffc93718d405ab9c88c305fb44fd1752 (patch)
tree236d9bd8ca7c35234c79ca362274c7a9e4332d1a /gn3/db/traits.py
parent1acd3873f44e0edff055c07fbb6d11066920f379 (diff)
downloadgenenetwork3-2d6a6f3cffc93718d405ab9c88c305fb44fd1752.tar.gz
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 <https://www.bonfacemunyoki.com/post/2021-10-21-comparing-floating-point-numbers/> on why comparing floating point numbers can be an issue.
Diffstat (limited to 'gn3/db/traits.py')
-rw-r--r--gn3/db/traits.py5
1 files 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)