diff options
Diffstat (limited to 'gn3')
| -rw-r--r-- | gn3/api/case_attributes.py | 2 | ||||
| -rw-r--r-- | gn3/db/case_attributes.py | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gn3/api/case_attributes.py b/gn3/api/case_attributes.py index b7f50ad..2f01202 100644 --- a/gn3/api/case_attributes.py +++ b/gn3/api/case_attributes.py @@ -17,7 +17,7 @@ from MySQLdb.cursors import DictCursor from gn3.db.case_attributes import ( CaseAttributeEdit, EditStatus, - queue_edit) + view_change, from authlib.integrations.flask_oauth2.errors import _HTTPException from flask import ( jsonify, diff --git a/gn3/db/case_attributes.py b/gn3/db/case_attributes.py index 48d77c7..4bdb654 100644 --- a/gn3/db/case_attributes.py +++ b/gn3/db/case_attributes.py @@ -144,6 +144,20 @@ def __fetch_case_attrs_changes__(cursor, change_ids: tuple) -> list: return results +def view_change(cursor, change_id: int) -> dict: + cursor.execute( + "SELECT json_diff_data " + "FROM caseattributes_audit " + "WHERE id = %s", + (change_id,) + ) + json_diff_data, _ = cursor.fetchone() + if json_diff_data: + json_diff_data = json.loads(json_diff_data) + return json_diff_data + return {} + + def get_changes(cursor, inbredset_id: int, directory: Path) -> dict: directory = f"{directory}/case-attributes/{inbredset_id}" if not os.path.exists(directory): |
