diff options
| author | Munyoki Kilyungi | 2025-06-25 14:57:58 +0300 |
|---|---|---|
| committer | BonfaceKilz | 2025-07-07 07:58:31 +0300 |
| commit | 23b9c6014a56b95f34a062fa792d86b6b7bde513 (patch) | |
| tree | 71d26b8d0fe134ff4f64b3a5e1e0fdab24448a75 /gn3 | |
| parent | 0bc56784d9e6f1a606a33cd33d99b39bb87734c1 (diff) | |
| download | genenetwork3-23b9c6014a56b95f34a062fa792d86b6b7bde513.tar.gz | |
Delete "approve_case_attribute."
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3')
| -rw-r--r-- | gn3/db/case_attributes.py | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/gn3/db/case_attributes.py b/gn3/db/case_attributes.py index ea3bf27..7076ec8 100644 --- a/gn3/db/case_attributes.py +++ b/gn3/db/case_attributes.py @@ -77,71 +77,3 @@ def queue_edit(cursor, directory: Path, edit: CaseAttributeEdit) -> int: review_ids.add(cursor.lastrowid) txn.put(b"review", pickle.dumps(review_ids)) return review_ids - - -def approve_case_attribute(conn: Any, case_attr_audit_id: int) -> int: - """Given the id of the json_diff in the case_attribute_audit table, - approve it - - """ - rowcount = 0 - try: - with conn.cursor() as cursor: - cursor.execute( - "SELECT json_diff_data FROM caseattributes_audit " - "WHERE id = %s", - (case_attr_audit_id,), - ) - diff_data = cursor.fetchone() - if diff_data: - diff_data = json.loads(diff_data[0]) - # Insert (Most Important) - if diff_data.get("Insert"): - data = diff_data.get("Insert") - cursor.execute( - "INSERT INTO CaseAttribute " - "(Name, Description) VALUES " - "(%s, %s)", - ( - data.get("name").strip(), - data.get("description").strip(), - ), - ) - # Delete - elif diff_data.get("Deletion"): - data = diff_data.get("Deletion") - cursor.execute( - "DELETE FROM CaseAttribute WHERE Id = %s", - (data.get("id"),), - ) - # Modification - elif diff_data.get("Modification"): - data = diff_data.get("Modification") - if desc_ := data.get("description"): - cursor.execute( - "UPDATE CaseAttribute SET " - "Description = %s WHERE Id = %s", - ( - desc_.get("Current"), - diff_data.get("id"), - ), - ) - if name_ := data.get("name"): - cursor.execute( - "UPDATE CaseAttribute SET " - "Name = %s WHERE Id = %s", - ( - name_.get("Current"), - diff_data.get("id"), - ), - ) - if cursor.rowcount: - cursor.execute( - "UPDATE caseattributes_audit SET " - "status = 'approved' WHERE id = %s", - (case_attr_audit_id,), - ) - rowcount = cursor.rowcount - except Exception as _e: - raise MySQLdb.Error(_e) from _e - return rowcount |
