diff options
author | Frederick Muriuki Muriithi | 2022-07-13 13:47:31 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-07-19 04:59:59 +0300 |
commit | e5c3ac00fa68f1180f1f33ba09e9786cf0e9cca5 (patch) | |
tree | 7e80cec2b6e192643a517e085e84220c2f845f07 /qc_app/dbinsert.py | |
parent | 68cf0750ee29d91abf8fe8d0a81426e324b41b12 (diff) | |
download | gn-uploader-e5c3ac00fa68f1180f1f33ba09e9786cf0e9cca5.tar.gz |
Replace redirect with user confirmation
Rather than using the redirect, that led to exposing the study id as a
get parameter, this commit adds an auxilliary step that allows the
user to choose whether to continue with the new study or go back and
select an existing study.
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 523152d..c106366 100644 --- a/qc_app/dbinsert.py +++ b/qc_app/dbinsert.py @@ -150,6 +150,9 @@ def create_study(): "Create a new study (ProbeFreeze)." form = request.form try: + assert form.get("filename"), "filename" + assert form.get("filetype"), "filetype" + assert form.get("species"), "species" assert form.get("genechipid"), "platform" assert form.get("studyname"), "study name" assert form.get("inbredsetid"), "group" @@ -170,9 +173,12 @@ def create_study(): "INSERT INTO ProbeFreeze() " "VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)") cursor.execute(query, values) - return redirect( - url_for("dbinsert.select_dataset", studyid=new_studyid), - code=307) + flash("Study created successfully", "alert-success") + return render_template( + "continue_from_create_study.html", + filename=form["filename"], filetype=form["filetype"], + species=form["species"], genechipid=form["genechipid"], + studyid=new_studyid) except AssertionError as aserr: flash(f"Missing data: {aserr.args[0]}", "alert-error") return redirect(url_for("dbinsert.select_study"), code=307) @@ -197,9 +203,9 @@ def select_dataset(): assert form.get("filetype"), "filetype" assert form.get("species"), "species" assert form.get("genechipid"), "platform" - assert (form.get("studyid") or request.args.get("studyid")), "study" + assert form.get("studyid"), "study" - studyid=(form.get("studyid") or request.args.get("studyid")) + studyid = form["studyid"] datasets = datasets_by_study(studyid) return render_template( "select_dataset.html", filename=form["filename"], |