diff options
author | Frederick Muriuki Muriithi | 2024-01-08 04:50:42 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-08 05:46:25 +0300 |
commit | cace7a50a45c6d227bce52569fcfc2944fbcbe92 (patch) | |
tree | bf625ff1467ba808784fa00c0852c35cd9f1d6ce /qc_app/samples.py | |
parent | 0677b36b2e144b07d7822661129cde0a82115b12 (diff) | |
download | gn-uploader-cace7a50a45c6d227bce52569fcfc2944fbcbe92.tar.gz |
Extract common database functions into a separate package.
Diffstat (limited to 'qc_app/samples.py')
-rw-r--r-- | qc_app/samples.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/qc_app/samples.py b/qc_app/samples.py index d27164e..107e889 100644 --- a/qc_app/samples.py +++ b/qc_app/samples.py @@ -48,35 +48,6 @@ def select_species(): flash("You need to select a species", "alert-error") return index_page -def save_population(conn: mdb.Connection, population_details: dict) -> int: - """Save the population details to the db.""" - with conn.cursor(cursorclass=DictCursor) as cursor: - cursor.execute("SELECT MAX(Id) AS last_id FROM InbredSet") - new_id = cursor.fetchone()["last_id"] + 1 - cursor.execute( - "INSERT INTO InbredSet(" - "Id, InbredSetId, InbredSetName, Name, SpeciesId, FullName, " - "MenuOrderId, Description" - ") " - "VALUES (" - "%(Id)s, %(InbredSetId)s, %(InbredSetName)s, %(Name)s, " - "%(SpeciesId)s, %(FullName)s, %(MenuOrderId)s, %(Description)s" - ")", - { - "Id": new_id, - "InbredSetId": new_id, - "MenuOrderId": 0, - **population_details - }) - return new_id - -def population_by_id(conn: mdb.Connection, population_id: int) -> dict: - """Get the grouping/population by id.""" - with conn.cursor(cursorclass=DictCursor) as cursor: - cursor.execute("SELECT * FROM InbredSet WHERE InbredSetId=%s", - (population_id,)) - return cursor.fetchone() - @samples.route("/upload/create-population", methods=["POST"]) def create_population(): """Create new grouping/population.""" |