diff options
author | Frederick Muriuki Muriithi | 2024-04-08 09:12:08 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-04-08 09:12:08 +0300 |
commit | 7ab16e0fcbc2efe2f446adc52a9df3a900d8561d (patch) | |
tree | f9b06ea3ee988e2e75f27ffb331c40c7640abb45 /qc_app/upload/rqtl2.py | |
parent | 6c308016bf354c6f6e6dddc6d580e524fce2b91e (diff) | |
download | gn-uploader-7ab16e0fcbc2efe2f446adc52a9df3a900d8561d.tar.gz |
bug: Check that Genotype dataset name is not duplicated.
Diffstat (limited to 'qc_app/upload/rqtl2.py')
-rw-r--r-- | qc_app/upload/rqtl2.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index 60aeba7..860a6a9 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -13,6 +13,7 @@ from redis import Redis from MySQLdb.cursors import DictCursor from flask import ( flash, + escape, request, url_for, redirect, @@ -453,6 +454,19 @@ def create_geno_dataset(species_id: int, population_id: int): "pub": public, "isetid": population_id } + cursor.execute("SELECT * FROM GenoFreeze WHERE Name=%s", + (datasetname,)) + results = cursor.fetchall() + if bool(results): + flash( + f"A genotype dataset with name '{escape(datasetname)}' " + "already exists.", + errorclasses) + return redirect(url_for("upload.rqtl2.select_dataset_info", + species_id=species_id, + population_id=population_id, + pgsrc="error"), + code=307) cursor.execute( "INSERT INTO GenoFreeze(" "Name, FullName, ShortName, CreateTime, public, InbredSetId" |