diff options
Diffstat (limited to 'qc_app/dbinsert.py')
-rw-r--r-- | qc_app/dbinsert.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py index 4711262..ab1c350 100644 --- a/qc_app/dbinsert.py +++ b/qc_app/dbinsert.py @@ -255,10 +255,8 @@ def select_dataset(): studyid = form["studyid"] datasets = datasets_by_study(studyid) return render_template( - "select_dataset.html", filename=form["filename"], - filetype=form["filetype"], totallines=form["totallines"], - species=form["species"], genechipid=form["genechipid"], - studyid=studyid, datasets=datasets, avgmethods=averaging_methods(), + "select_dataset.html", **{**form, "studyid": studyid}, + datasets=datasets, avgmethods=averaging_methods(), datascales=dataset_datascales()) except AssertionError as aserr: return render_error(f"Missing data: {aserr.args[0]}") @@ -283,11 +281,19 @@ def create_dataset(): with database_connection() as conn: with conn.cursor(cursorclass=DictCursor) as cursor: + datasetname = form["datasetname"] + cursor.execute("SELECT * FROM ProbeSetFreeze WHERE Name=%s", + (datasetname,)) + results = cursor.fetchall() + if bool(results): + flash("A dataset with that name already exists.", + "alert-error") + return redirect(url_for("dbinsert.select_dataset"), code=307) cursor.execute("SELECT MAX(Id) AS last_id FROM ProbeSetFreeze") new_datasetid = cursor.fetchone()["last_id"] + 1 values = ( new_datasetid, form["studyid"], form["avgid"], - form.get("datasetname",""), form["datasetname2"], + datasetname, form["datasetname2"], form["datasetfullname"], form["datasetshortname"], datetime.now().date().strftime("%Y-%m-%d"), form["datasetpublic"], form["datasetconfidentiality"], |