aboutsummaryrefslogtreecommitdiff
path: root/qc_app/dbinsert.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-07-07 13:07:55 +0300
committerFrederick Muriuki Muriithi2022-07-07 13:07:55 +0300
commitb367d04c57b21c0a9e2da22e8b20404de076768d (patch)
tree85e58879965fc2da1d90dd0a39a30732bcb8ffc2 /qc_app/dbinsert.py
parent23a5e2c8dc2cbbf1ce55c22f80519824e413b883 (diff)
downloadgn-uploader-b367d04c57b21c0a9e2da22e8b20404de076768d.tar.gz
Add filetype details to database update code
The filetype determines the queries to be run to update the database, therefore, this commit adds filetype information.
Diffstat (limited to 'qc_app/dbinsert.py')
-rw-r--r--qc_app/dbinsert.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py
index 5381fb5..fac546b 100644
--- a/qc_app/dbinsert.py
+++ b/qc_app/dbinsert.py
@@ -81,7 +81,8 @@ def select_dataset():
types=group_types, datasets=datasets,
menu_contents=json.dumps(menu_contents),
genechips_data=json.dumps(gchips),
- genechips=gchips.get(default_species, []))
+ genechips=gchips.get(default_species, []),
+ filetype=job["filetype"])
return render_error(f"File '{filename}' no longer exists.")
return render_error(f"Job '{job_id}' no longer exists.")
return render_error("Unknown error")
@@ -95,10 +96,13 @@ def insert_data():
filepath = f"{app.config['UPLOAD_FOLDER']}/{filename}"
if os.path.exists(filepath):
try:
- dataset_id = int(form["dataset"])
- return (f"Would insert data in file '{filepath}' "
- "into the database with the dataset "
- f"{dataset_id}")
+ species = form["species"]
+ filetype = form["filetype"]
+ datasetid = int(form["dataset"])
+ genechipid = int(form["genechipid"])
+ return (f"Would insert '{species}' data in '{filetype}' file "
+ f"'{filepath}' into the database with the dataset "
+ f"'{datasetid}' and genechip '{genechipid}'.")
except ValueError as ve:
msg = "::".join(ve.args)
return render_error(f"Invalid value: {msg}")