aboutsummaryrefslogtreecommitdiff
path: root/qc_app/upload
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-04-08 09:12:08 +0300
committerFrederick Muriuki Muriithi2024-04-08 09:12:08 +0300
commit7ab16e0fcbc2efe2f446adc52a9df3a900d8561d (patch)
treef9b06ea3ee988e2e75f27ffb331c40c7640abb45 /qc_app/upload
parent6c308016bf354c6f6e6dddc6d580e524fce2b91e (diff)
downloadgn-uploader-7ab16e0fcbc2efe2f446adc52a9df3a900d8561d.tar.gz
bug: Check that Genotype dataset name is not duplicated.
Diffstat (limited to 'qc_app/upload')
-rw-r--r--qc_app/upload/rqtl2.py14
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"