aboutsummaryrefslogtreecommitdiff
path: root/qc_app
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-03-19 04:48:43 +0300
committerFrederick Muriuki Muriithi2024-03-19 04:59:47 +0300
commit38227b8e482ea10f8bb111a1a90f22f8f019e2ab (patch)
tree7dce6c9330ea701b01e01b6ecab441106a71ea01 /qc_app
parent13bc6684cc2f90b1fdac306a2ce9a8849911b43f (diff)
downloadgn-uploader-38227b8e482ea10f8bb111a1a90f22f8f019e2ab.tar.gz
Query by `Id` rather than `ProbeFreezeId`
Previously `ProbeFreezeId` was set as 1 more than the largest `Id` value found, which might not end up being the same as the incremented Id. This commit, thus, queries by `Id` which is more robust, and does an actual update for the `ProbeFreezeId` column to make it same value as `Id`.
Diffstat (limited to 'qc_app')
-rw-r--r--qc_app/dbinsert.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/qc_app/dbinsert.py b/qc_app/dbinsert.py
index f36651f..150127d 100644
--- a/qc_app/dbinsert.py
+++ b/qc_app/dbinsert.py
@@ -171,6 +171,10 @@ def create_study():
"ShortName, CreateTime, InbredSetId) "
"VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)")
cursor.execute(query, values)
+ lastrowid = cursor.lastrowid
+ cursor.execute(
+ "UPDATE ProbeFreeze SET ProbeFreezeId=%s WHERE Id=%s",
+ (lastrowid, lastrowid))
flash("Study created successfully", "alert-success")
return render_template(
"continue_from_create_study.html",
@@ -294,7 +298,7 @@ def study_by_id(studyid:int) -> Union[dict, None]:
with database_connection() as conn:
with conn.cursor(cursorclass=DictCursor) as cursor:
cursor.execute(
- "SELECT * FROM ProbeFreeze WHERE ProbeFreezeId=%s",
+ "SELECT * FROM ProbeFreeze WHERE Id=%s",
(studyid,))
return cursor.fetchone()